#29214: Invalid SQL generated when annotating a subquery with an outerref to an
annotated field.
-------------------------------------+-------------------------------------
     Reporter:  Oskar Persson        |                    Owner:  Chetan
                                     |  Khanna
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  queryset             |             Triage Stage:  Accepted
  annotations                        |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Bálint Balina):

 Ok, I have super simple solution, but I would like to pre check if this is
 a possible way to go. Can we use lower case table aliases?

 I have applied the following monkeypatch, and everything works fine for my
 case:

 {{{
 Query.alias_prefix = 't'
 Query.subq_aliases = frozenset(['t'])

 def bump_prefix(self, outer_query):
     ...
     alphabet = ascii_lowercase
     ...
 Query.bump_prefix = bump_prefix
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29214#comment:21>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.5f7994b8c93fb555ab4de63cbbd31bf5%40djangoproject.com.

Reply via email to