#32006: QuerySet with values with annotate generates wrong SQL query on 
PostgreSQL.
-------------------------------------+-------------------------------------
     Reporter:  Konstantin Popov     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  3.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  QuerySet values      |             Triage Stage:
  annotate GROUP BY                  |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Konstantin Popov):

 I just now realized what is causing the problem.

 I use declarative partitioning in some tables, so the primary key must
 include the partitioning key and has two fields, 'id' and 'period'.

 To use such tables with Django, I developed my own versions of the
 CreateModel and AddField migration operations, as well as my own version
 of the ForeignKey field.

 However, the Django Model class code still considers its primary key to be
 a single 'id' field.
 I have already discovered a number of side effects of this solution. Now
 there is another one.

 It may be best to leave this ticket closed. Please accept my apologies for
 the needless concern.

 I am ready to provide an abbreviated version of my code here if anyone is
 interested.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32006#comment:4>
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/067.8fe9c0f5d7e201f1707e68fca1b28a11%40djangoproject.com.

Reply via email to