OrderByClauseVisitor does not use fully qualified column names #968
Labels
in: selectbuilder
SelectBuilder stands for the complete API for creating SQL statements programmatically.
type: enhancement
A general enhancement
Milestone
Hi,
For queries with joins, we occasionally end up with situations where a column name becomes ambiguous and we need to qualify it with the table / alias - as an example, our hand-rolled SQL generated created the following SQL from our test samples:
When migrating our SQL generator to generate
Select
and use theSelectRenderer
, we discovered that the generatedORDER BY
clause becameORDER BY street_name ASC, street_name ASC
. This is ambiguous asstreet_name
is defined from multiple sources (once fromcustomer_address
and once fromwarehouse_address
).As a work around, I have migrated it to use the aliased columns, which mitigates the problem as long as the ORDER BY only references columns that are SELECT'ed. In at least PostgreSQL, you can include other columns in
ORDER BY
, so we would like this to be supported via Spring as well.The text was updated successfully, but these errors were encountered: