Changes between Initial Version and Version 1 of Ticket #33768


Ignore:
Timestamp:
Jun 5, 2022, 2:47:04 PM (2 years ago)
Author:
Florian Apolloner
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33768 – Description

    initial v1  
    4747}}}
    4848
    49 Due to the `UNION` we are rewriting queries to use column numbers so we can somewhat reliably target the columns. This breaks down when `nulls_first/last` is used because `(1) IS NULL` is interpreted as expression in mysql and not as the colname 1 being NULL. Which brings me back to https://twitter.com/fapolloner/status/1533512493208936450 -- I think that the rewriting of thise expression should happen in the compiler and not in `OrderBy` itself. This way we could duplicate the `OrderBy` into two and push them into the relevant select clauses like we already do in https://github.com/django/django/blob/49b470b9187b6be60e573fed08c8f4a87f133750/django/db/models/sql/compiler.py#L410 for other things.
     49Due to the `UNION` we are rewriting queries to use column numbers so we can somewhat reliably target the columns. This breaks down when `nulls_first/last` is used because `(1) IS NULL` is interpreted as expression in mysql and not as the colname 1 being NULL. Which brings me back to https://twitter.com/fapolloner/status/1533512493208936450 -- I think that the rewriting of this expression should happen in the compiler and not in `OrderBy` itself. This way we could duplicate the `OrderBy` into two and push them into the relevant select clauses like we already do in https://github.com/django/django/blob/49b470b9187b6be60e573fed08c8f4a87f133750/django/db/models/sql/compiler.py#L410 for other things.
    5050
    5151Sadly it is a mess… Thoughts? Paging Adam since he was the resident MySQL specialist IIRC :)
Back to Top