#10127: select_related does not play well with annotate
---------------------------------------------------+------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Comment (by ramiro):
FWIW I can reproduce this with r9791:
* On win32 with Python 2.5.2 + its bundled SQLite stuff (3.3.4 /
`sqlite3` module is 3.3.2) and with MySQL-python 1.2.2
* On Debian (stable/Etch) with both:
* Python 2.4.4 + MySQL-python 1.2.1p2, SQLite and Postgres (see below
for more info)
* Python 2.5 + MySQL-python 1.2.2 and and its `sqlite3` module
On Debian, SQLite version is always 3.3.8, pysqlite/sqlite3 is 2.3.2.
MySQL version is always 5.0.32, MyISAM storage engine.
Under Debian, using python-psycopg2 2.0.5.1 against Postgres 8.1 it also
fails but with an exception:
{{{
----------------------------------------------------------------------
File "~/t10127_test/tests/modeltests/aggregation/models.py", line ?, in
modeltests.aggregation.models.__te
st__.API_TESTS
Failed example:
sorted([(b.name, b.authors__age__avg) for b in books])
Exception raised:
Traceback (most recent call last):
File "~/t10127_test/django/test/_doctest.py", line 1267, in __run
compileflags, 1) in test.globs
File "<doctest
modeltests.aggregation.models.__test__.API_TESTS[22]>", line 1, in ?
sorted([(b.name, b.authors__age__avg) for b in books])
File "~/t10127_test/django/db/models/query.py", line 186, in
_result_iter
self._fill_cache()
File "~/t10127_test/django/db/models/query.py", line 667, in
_fill_cache
self._result_cache.append(self._iter.next())
File "~/t10127_test/django/db/models/query.py", line 281, in
iterator
for row in self.query.results_iter():
File "~/t10127_test/django/db/models/sql/query.py", line 240, in
results_iter
for rows in self.execute_sql(MULTI):
File "~/t10127_test/django/db/models/sql/query.py", line 1960, in
execute_sql
cursor.execute(sql, params)
ProgrammingError: column "aggregation_publisher.id" must appear in the
GROUP BY clause or be used in an aggregate function
----------------------------------------------------------------------
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/10127#comment:3>
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
-~----------~----~----~----~------~----~------~--~---