Avoid order by on sub queries in postgresql reflection #8561
Labels
bug
Something isn't working
postgresql
reflection
reflection of tables, columns, constraints, defaults, sequences, views, everything else
Milestone
I'm fairly sure that the order by we apply to subqueries in the postresql reflection, such as
sqlalchemy/lib/sqlalchemy/dialects/postgresql/base.py
Lines 3651 to 3678 in 9ae645d
may not correct, since a db can technically ignore it from what I gather.
I don't think this ever happened in our test, but it's probably better to use an alternative or get confirmation that the query is indeed correct. @zzzeek I can try asking to the postgresql mailing list for help if you don't have a better suggestion.
Since the use case is use
array_agg
and a group by we investigate ordering in thearray_agg
construct, usingaggregate_order_by
.In this case we would need to make aggregate_order_by generate a cache key, since at the moment it's not able to.
The text was updated successfully, but these errors were encountered: