#19263: DatabaseError on using empty Page .object_list in __in clause in a query
-------------------------------+--------------------------------------
Reporter: chkwok@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by chkwok):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I've traced the change back, but it doesn't seem to be introduced at 1.4.
On 1.2, this works:
{{{
C:\Dev\django\bugs>manage.py shell
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from bugtest.models import *
>>> crash()
[]
>>> import django
>>> django.VERSION
(1, 2, 0, 'final', 0)
>>>
}}}
On 1.3.4:
{{{
C:\Dev\django\bugs>manage.py shell
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from bugtest.models import *
>>> crash()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Dev\django\bugs\bugtest\models.py", line 16, in crash
print books
File "C:\Dev\Python27\lib\site-
packages\django-1.3.4-py2.7.egg\django\db\models\query.py", line 69, in
__repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "C:\Dev\Python27\lib\site-
packages\django-1.3.4-py2.7.egg\django\db\models\query.py", line 84, in
__len__
self._result_cache.extend(self._iter)
File "C:\Dev\Python27\lib\site-
packages\django-1.3.4-py2.7.egg\django\db\models\query.py", line 273, in
iterator
for row in compiler.results_iter():
File "C:\Dev\Python27\lib\site-
packages\django-1.3.4-py2.7.egg\django\db\models\sql\compiler.py", line
680, in results
_iter
for rows in self.execute_sql(MULTI):
File "C:\Dev\Python27\lib\site-
packages\django-1.3.4-py2.7.egg\django\db\models\sql\compiler.py", line
735, in execute
_sql
cursor.execute(sql, params)
File "C:\Dev\Python27\lib\site-
packages\django-1.3.4-py2.7.egg\django\db\backends\util.py", line 34, in
execute
return self.cursor.execute(sql, params)
File "C:\Dev\Python27\lib\site-
packages\django-1.3.4-py2.7.egg\django\db\backends\postgresql_psycopg2\base.py",
line 4
4, in execute
return self.cursor.execute(query, args)
DatabaseError: syntax error at or near ")"
LINE 1: ...ugtest_book" WHERE "bugtest_book"."author_id" IN () LIMIT 21
^
>>> import django; django.VERSION
(1, 3, 4, 'final', 0)
}}}
It's also database dependent, I couldn't reproduce the issue with SQLite.
--
Ticket URL: <https://code.djangoproject.com/ticket/19263#comment:1>
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.