#34123: Ambiguous aliases in ordering on combined queries with select_related().
-------------------------------------+-------------------------------------
     Reporter:  Shai Berger          |                    Owner:  David
                                     |  Sanders
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:  select_related       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by David Sanders):

 Simon, correct the `1st ORDER BY term does not match any column in the
 result set` on SQLite also happens because of the ambiguous reference in
 `ORDER BY id` from `first()` when using `select_related()`.

 I'm currently trying to determine a better way to determine an order by
 match rather than relying on aliases like is currently being done:
 
https://github.com/django/django/blob/main/django/db/models/sql/compiler.py#L464-L467

 (because if selects are always aliases then this is no longer something
 that can be relied on)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34123#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018432e7a854-cd0ec9bf-697d-450b-af3b-7b011fde3f75-000000%40eu-central-1.amazonses.com.

Reply via email to