#26758: Annotate appears broken with Postgres in recent releases
-------------------------------------+-------------------------------------
Reporter: darkpixel | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by frafra):
Replying to [comment:6 charettes]:
> Can you reproduce with the [https://github.com/charettes/django-
ticketing/commit/78ed6a345e760ea46434690e9385ae4d26fc2810 sample app] I
provided? Else I'm afraid you'll need to provide more details.
I am able to reproduce this issue using the same app.
Software used:
* Django 1.9.2
* PostgreSQL 9.0.13
{{{
Using existing test database for alias 'default'...
E
======================================================================
ERROR: test_foo (ticket_26758.tests.FooTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: column "ticket_26758_company.owner_id" must
appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "ticket_26758_company"."owner_id", "ticket_26758_comp...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/frafra/Scaricati/ticket/ticket_26758/tests.py", line 10, in
test_foo
print(list(qs))
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/models/query.py", line 258, in __iter__
self._fetch_all()
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/models/query.py", line 52, in __iter__
results = compiler.execute_sql()
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/frafra/.local/lib/python3.5/site-
packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/frafra/.local/lib/python3.5/site-
packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "ticket_26758_company.owner_id"
must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "ticket_26758_company"."owner_id", "ticket_26758_comp...
^
----------------------------------------------------------------------
Ran 1 test in 0.478s
FAILED (errors=1)
Preserving test database for alias 'default'...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26758#comment:10>
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/067.36615a9ddcc53fabbd1ff607c8eb5ac0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.