#10432: Empty generator in "in" lookup gives incorrect SQL
------------------------------------------+---------------------------------
 Reporter:  Anossov                       |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  SVN       
 Keywords:  sql where                     |       Stage:  Unreviewed
Has_patch:  1                             |  
------------------------------------------+---------------------------------
 Simple story, here's what happens:

 {{{
 > User.objects.filter(pk__in=[]) # ok
 []

 > User.objects.filter(pk__in=(x for x in [])).query.as_sql() #
 ProgrammingError
 (...)
 ProgrammingError: (1064, "You have an error in your SQL syntax; check the
 manual that corresponds to your MySQL server version for the right syntax
 to use near ') LIMIT 21' at line 1")

 > User.objects.filter(pk__in=(x for x in [])).query.as_sql()
 (u'SELECT (...) FROM `user` WHERE `user`.`id` IN ()',
  ())
 }}}

 '''A''' patch is included.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10432>
Django <http://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 this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to