#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 Comment: 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`. {{{#!python SELECT "test_app_application"."id", CASE 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" WHERE CASE 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 https://groups.google.com/d/msgid/django-updates/062.305e94e5024c4c8f97451055d39b7133%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.