#32476: Django Query Generating Style Error
-------------------------------------+-------------------------------------
               Reporter:  thajones   |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.1
  layer (models, ORM)                |       Keywords:  Query,
               Severity:  Normal     |  Missing_Brackets
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 var = modelname.objects.exclude( field1__isnull = True, field1__exact = ''
 )

 print(var.query)
 # select * from modelname where not ( field1 != '' and field1 is not null
 and field1 is null ) which is always a empty set.

 Expected Query:
 # select * from modelname where not ( field1 != '' and field1 is null )
 OR
 # select * from modelname where not ((field1 != '' and field1 is not null)
 and field1 is null )

 which gives resultant set with non empty and not null records.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32476>
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/051.9ac194da7867dbfb30fff8a2fe436f8a%40djangoproject.com.

Reply via email to