#33374: ExpressionWrapper for ~Q(pk__in=[]) broken
-----------------------------------------+------------------------
               Reporter:  StefanBrand    |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Uncategorized  |        Version:  3.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 == Problem Description

 I'm reducing some Q objects (similar to what is described in ticket:32554.
 Everything is fine for the case where the result is
 `ExpressionWrapper(Q(pk__in=[]))`. However, when I reduce to
 `ExpressionWrapper(~Q(pk__in=[]))` the query breaks.

 == Symptoms

 === Working for `ExpressionWrapper(Q(pk__in=[]))`
 {{{#!python
 print(queryset.annotate(foo=ExpressionWrapper(Q(pk__in=[]),
 output_field=BooleanField())).values("foo").query)
 }}}

 {{{#!sql
 SELECT 0 AS "foo" FROM "agri_data_declaration"
 }}}

 === Not working for `ExpressionWrapper(~Q(pk__in=[]))`

 {{{#!python
 print(declarations.annotate(foo=ExpressionWrapper(~Q(pk__in=[]),
 output_field=BooleanField())).values("foo").query)
 }}}
 {{{#!sql
 SELECT  AS "foo" FROM "agri_data_declaration"
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33374>
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/054.916f9560eb2d4bff78031d1cf42dff5a%40djangoproject.com.

Reply via email to