Zell may want to refute that this is a good idea, but if I try to order by a

computed field in a computed record, Depot freaks out because it doesn't know
what table the computed field comes from when it doesn't come from any table.

So clearly this is what we want to achieve that functionality, but what I'm not
100% sure about is what ass biting we're opening ourselves up to here by not
freaking out in this case. We may be taking a step backwards in terms of useful
error reporting if someone does something stupid with computed fields. But
we'll just have to see what those errors are when they crop up. If the database
can't figure out what we're talking about with the unqualified field name, it
too will freak out.
This commit is contained in:
Michael Bayne
2009-08-07 02:49:20 +00:00
parent 37295dbcb3
commit 363614dff5
@@ -690,19 +690,15 @@ public abstract class BuildVisitor implements ExpressionVisitor<Void>
}
}
// if we get this far we hopefully have a table to select from
if (tableClass != null) {
if (_defaultType != tableClass) {
appendTableAbbreviation(tableClass);
_builder.append(".");
}
appendIdentifier(fm.getColumnName());
return;
// if we get this far we hopefully have a table to select from, if not we're probably doing
// something like an order by on a synthetic field "select count(distinct foo) as bar from
// ... order by bar", so we just skip the table qualifier
if (tableClass != null && _defaultType != tableClass) {
appendTableAbbreviation(tableClass);
_builder.append(".");
}
// else owie
throw new IllegalArgumentException(
"Persistent field has no definition [class=" + type + ", field=" + field + "]");
appendIdentifier(fm.getColumnName());
}
// output one of potentially many fields in an index expression