#27241: Annotate doesn't work with PostgreSQL views anymore
-------------------------------------+-------------------------------------
     Reporter:  jaap3                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  postgresql view      |             Triage Stage:  Accepted
  aggregate annotate                 |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jaap3):

 I don't known if disabling the optimisation for all unmanaged models is
 the right choice. It seems that this is a fairly esoteric edge case. The
 fact that this behaviour was changed in 1.9 and almost nobody has noticed
 until now speaks for itself (I can only find one other issue that looks
 similar: #26758).

 I'm sure that most unmanaged models are normal database tables with a
 primary key constraint. It would be a shame to have to disable something
 that works fine for the vast majority of use cases just because of this
 one edge case.

 Instead, would it be feasible to be able to opt-out of the optimisation by
 setting a flag on the model's Meta class? So instead of checking if
 `managed` is `False`, Django could check if `allows_group_by_selected_pks`
 is set to `False` for the model and then choose not to perform the related
 optimisation.

 I am actively maintaining this application and would have no qualms about
 adding a flag to the few models affected by this issue. If anyone else
 runs into this the must also be actively maintaining theirs so they can do
 the same thing.

--
Ticket URL: <https://code.djangoproject.com/ticket/27241#comment:7>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.1761d0d9ee85c7b8e0fd23b0e554fb5b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to