#29291: Conditional expressions and ~Q queries
     Reporter:  Bo Marchman          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
Changes (by Simon Charette):

 * version:  2.0 => master
 * stage:  Unreviewed => Accepted


 I feel like `qs2` is correct and that `q1` should be using a subquery as
 well to correctly deal with SQL's boolean logic with regards to `NULL`.

 SELECT "test_app_application"."id",
           WHEN NOT ("test_app_application"."id" IN
              (SELECT U1."application_id"
               FROM "test_app_score" U1
               WHERE U1."reviewed" = TRUE)) THEN TRUE
           ELSE FALSE
       END as "needs_review"
 FROM "test_app_application"
           WHEN NOT ("test_app_application"."id" IN
              (SELECT U2."application_id"
               FROM "test_app_score" U2
               WHERE U2."reviewed" = TRUE)) THEN TRUE
           ELSE FALSE
       END = TRUE

 I'm not sure how to convert it into a subquery pushdown though.

Ticket URL: <https://code.djangoproject.com/ticket/29291#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 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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to