#26056: ArrayField does not work with ValueListQuerySet
----------------------------------+-----------------
Reporter: CGenie | Owner:
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+-----------------
Basically queries of type:
{{{#!python
A.objects.filter(array_field__overlap=B.objects.filter(foo))
}}}
fail at Python level:
{{{
Traceback (most recent call last):
File "failing.py", line 9, in <module>
UserList.objects.filter(users__overlap=User.objects.all().values_list('id',
flat=True)).count()
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/query.py", line 318, in
count
return self.query.get_count(using=self.db)
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/sql/query.py", line 466,
in get_count
number = obj.get_aggregation(using, ['__count'])['__count']
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/sql/query.py", line 447,
in get_aggregation
result = compiler.execute_sql(SINGLE)
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/sql/compiler.py", line
829, in execute_sql
sql, params = self.as_sql()
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/sql/compiler.py", line
387, in as_sql
where, w_params = self.compile(self.query.where)
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/sql/compiler.py", line
357, in compile
sql, params = node.as_sql(self, self.connection)
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/sql/where.py", line 104,
in as_sql
sql, params = compiler.compile(child)
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/db/models/sql/compiler.py", line
357, in compile
sql, params = node.as_sql(self, self.connection)
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/contrib/postgres/fields/array.py",
line 183, in as_sql
sql, params = super(ArrayOverlap, self).as_sql(qn, connection)
File "/home/przemek/.virtualenvs/italamo/lib/python2.7/site-
packages/Django-1.8.5-py2.7.egg/django/contrib/postgres/lookups.py", line
8, in as_sql
params = lhs_params + rhs_params
TypeError: can only concatenate list (not "tuple") to list
}}}
Toy project to reproduce this behavior can be found here:
https://github.com/CGenie/django_array_join_fail
This fails in 1.8 as well as in 1.9.
--
Ticket URL: <https://code.djangoproject.com/ticket/26056>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.1a89f64e6947cdcf939ed0de9b031452%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.