Opened 23 months ago

Last modified 22 months ago

#21252 new Bug

Positional column numbers is not always correct for ORDER BY and GROUP BY

Reported by: manfre Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


"SELECT ... GROUP BY 1 ORDER BY 1" is very fragile and may not associate with the intended column if any columns are front loaded on to the select. Columns are front loaded by extra() and could be added by 3rd party database backends.

There are discussions of no longer front loading the extra() select columns. Assuming this change happens, the problem space would be reduced to just 3rd party backends, which would need some way to know that there are positional values in the query or would need an easier way of injecting columns in to the select without resorting to the simple front loading.

Change History (1)

comment:1 Changed 22 months ago by akaariai

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

I agree. Seems to be issue only in DateQueries, and hopefully that area will be improved soonish.

Note: See TracTickets for help on using tickets.
Back to Top