Re: [Django] #25998: SQLCompiler error when using Paginator + values(...) when query returns no data

2015-12-29 Thread Django
#25998: SQLCompiler error when using Paginator + values(...) when query returns 
no
data
-+-
 Reporter:  awbacker |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.9
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  SQLCompiler, | Triage Stage:
  Paginator, values  |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by awbacker):

 Installed `Django==1.9.1.dev20151228224945` directly from github and the
 issue is fixed.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.b7cb9e219a321e671b508a015fa5278b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25998: SQLCompiler error when using Paginator + values(...) when query returns no data

2015-12-29 Thread Django
#25998: SQLCompiler error when using Paginator + values(...) when query returns 
no
data
-+-
 Reporter:  awbacker |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.9
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  SQLCompiler, | Triage Stage:
  Paginator, values  |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by awbacker:

Old description:

> I am experiencing a crash in the `SQLCompiler` when I try to execute a
> paginated query after calling `.values(...)`.
>
> {{{
> AttributeError: 'SQLCompiler' object has no attribute 'col_count'
> }}}
>
> * Postgres 9.3, psycopg2==2.6.1
> * Django 1.9
> * No data is present in the table
>
> {{{
> # Query must have NO data returned for it
> qs = Room.objects.values('id')
> pg = Paginator(per_page=1, object_list=qs)
> res = list(pg.page(0))
>
> class Room(models.Model):
> has_tv = models.BooleanField()
> }}}
>
> {{{
> ==
> ERROR: test_pure_django (api.tests.test_api_call.TestApiCall)
> --
> Traceback (most recent call last):
>   File "/Users/andrew/dev/st/abc/api/tests/test_api_call.py", line 25, in
> test_pure_django
> res = list(pg.page(1))
>   File "/Users/andrew/dev/st/abc/venv/bin/../lib/python2.7/_abcoll.py",
> line 602, in __iter__
> v = self[i]
>   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
> packages/django/core/paginator.py", line 125, in __getitem__
> self.object_list = list(self.object_list)
>   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
> packages/django/db/models/query.py", line 258, in __iter__
> self._fetch_all()
>   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
> packages/django/db/models/query.py", line 1074, in _fetch_all
> self._result_cache = list(self.iterator())
>   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
> packages/django/db/models/query.py", line 112, in __iter__
> for row in compiler.results_iter():
>   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
> packages/django/db/models/sql/compiler.py", line 807, in results_iter
> fields = [s[0] for s in self.select[0:self.col_count]]
> AttributeError: 'SQLCompiler' object has no attribute 'col_count'
> }}}
>
> I have a fairly minimal reproduction, and can try to reduce it even
> further (removing DRF, psycopg2, etc) if needed.  I don't think it's an
> issue with postgres.  I think it has something to do with the
> ValuesIterable, but have no way of telling for sure.

New description:

 I am experiencing a crash in the `SQLCompiler` when I try to execute a
 paginated query after calling `.values(...)`.

 {{{
 AttributeError: 'SQLCompiler' object has no attribute 'col_count'
 }}}

 * Postgres 9.3, psycopg2==2.6.1
 * Django 1.9
 * No data is present in the table

 {{{
 # Query must have NO data returned for it
 qs = Room.objects.values('id')
 pg = Paginator(per_page=1, object_list=qs)
 res = list(pg.page(1))

 class Room(models.Model):
 has_tv = models.BooleanField()
 }}}

 {{{
 ==
 ERROR: test_pure_django (api.tests.test_api_call.TestApiCall)
 --
 Traceback (most recent call last):
   File "/Users/andrew/dev/st/abc/api/tests/test_api_call.py", line 25, in
 test_pure_django
 res = list(pg.page(1))
   File "/Users/andrew/dev/st/abc/venv/bin/../lib/python2.7/_abcoll.py",
 line 602, in __iter__
 v = self[i]
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/core/paginator.py", line 125, in __getitem__
 self.object_list = list(self.object_list)
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/query.py", line 258, in __iter__
 self._fetch_all()
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/query.py", line 1074, in _fetch_all
 self._result_cache = list(self.iterator())
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/query.py", line 112, in __iter__
 for row in compiler.results_iter():
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py", line 807, in results_iter
 fields = [s[0] for s in self.select[0:self.col_count]]
 AttributeError: 

Re: [Django] #25998: SQLCompiler error when using Paginator + values(...) when query returns no data

2015-12-29 Thread Django
#25998: SQLCompiler error when using Paginator + values(...) when query returns 
no
data
-+-
 Reporter:  awbacker |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.9
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  SQLCompiler, | Triage Stage:
  Paginator, values  |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * needs_better_patch:   => 0
 * resolution:   => duplicate
 * needs_tests:   => 0
 * needs_docs:   => 0
 * type:  Uncategorized => Bug


Comment:

 This looks like a duplicate of #25894 which will be fixed in the upcoming
 1.9.1 release. Can you verify the issue is fixed for you on the
 `stable/1.9.x` branch and reopen if not? Thanks.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.0b50cd8ffc0b8f1938f5e879cab5b31b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #25998: SQLCompiler error when using Paginator + values(...) when query returns no data

2015-12-29 Thread Django
#25998: SQLCompiler error when using Paginator + values(...) when query returns 
no
data
-+-
 Reporter:  awbacker |  Owner:  nobody
 Type:  Uncategorized| Status:  new
Component:  Database layer   |Version:  1.9
  (models, ORM)  |   Keywords:  SQLCompiler, Paginator,
 Severity:  Normal   |  values
 Triage Stage:  Unreviewed   |  Has patch:  0
Easy pickings:  0|  UI/UX:  0
-+-
 I am experiencing a crash in the `SQLCompiler` when I try to execute a
 paginated query after calling `.values(...)`.

 {{{
 AttributeError: 'SQLCompiler' object has no attribute 'col_count'
 }}}

 * Postgres 9.3, psycopg2==2.6.1
 * Django 1.9
 * No data is present in the table

 {{{
 # Query must have NO data returned for it
 qs = Room.objects.values('id')
 pg = Paginator(per_page=1, object_list=qs)
 res = list(pg.page(0))

 class Room(models.Model):
 has_tv = models.BooleanField()
 }}}

 {{{
 ==
 ERROR: test_pure_django (api.tests.test_api_call.TestApiCall)
 --
 Traceback (most recent call last):
   File "/Users/andrew/dev/st/abc/api/tests/test_api_call.py", line 25, in
 test_pure_django
 res = list(pg.page(1))
   File "/Users/andrew/dev/st/abc/venv/bin/../lib/python2.7/_abcoll.py",
 line 602, in __iter__
 v = self[i]
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/core/paginator.py", line 125, in __getitem__
 self.object_list = list(self.object_list)
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/query.py", line 258, in __iter__
 self._fetch_all()
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/query.py", line 1074, in _fetch_all
 self._result_cache = list(self.iterator())
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/query.py", line 112, in __iter__
 for row in compiler.results_iter():
   File "/Users/andrew/dev/st/abc/venv/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py", line 807, in results_iter
 fields = [s[0] for s in self.select[0:self.col_count]]
 AttributeError: 'SQLCompiler' object has no attribute 'col_count'
 }}}

 I have a fairly minimal reproduction, and can try to reduce it even
 further (removing DRF, psycopg2, etc) if needed.  I don't think it's an
 issue with postgres.  I think it has something to do with the
 ValuesIterable, but have no way of telling for sure.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.e7124f0cbb6a1f7f9c928b3b58a9882f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.