#19173: "query" param for Model.objects.none() queryset has unexpected value.
-----------------------------------+--------------------
     Reporter:  joshua.fialkoff@…  |      Owner:  nobody
         Type:  Uncategorized      |     Status:  new
    Component:  Uncategorized      |    Version:  1.4
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 1. Create Django model:


 {{{
 class Location(models.Model):
   name = models.CharField(max_length=100)
 }}}


 2. Get a null set


 {{{
 res = Location.objects.none()
 }}}


 3. Check the SQL relating to this set:


 {{{
 print(res.query.sql_with_params())
 >> ('SELECT "name" FROM "location", ())
 }}}


 The SQL above would actually return all the records in the database. My
 expectation is that I'd get the same result here as when I do the
 following:


 {{{
 query = Location.objects.filter(id__in=[])
 print(query.sql_with_params())
 }}}


 This, in fact, throws an EmptyResultSet error which seems reasonable as
 there's really no SQL statement to go along with a purposefully empty set.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19173>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to