private void replaceFieldRelation(Field field, Relation oldRelation, Relation newRelation) {
		if (field instanceof NamedField) {
			if (((NamedField)field).getRelation() == oldRelation) {
				((NamedField)field).replaceRelation(newRelation);
			}
		} else if (field instanceof AggregateField) {
			this.replaceFieldRelation(((AggregateField)field).getField(), oldRelation, newRelation);
		} else if (field instanceof FunctionField) {
			this.replaceFieldRelation(((FunctionField)field).getField(), oldRelation, newRelation);
		} else if (field instanceof ExpressionField) {
			for (Field subField : ((ExpressionField)field).getFields()) {
				this.replaceFieldRelation(subField, oldRelation, newRelation);
			}
		}
	}