id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 11332,Group by doesn't work properly with PosgreSQL,Loststylus,nobody,"I am trying to execute a query running Django 1.0.2 with PostgreSQL 8.3: >>> from accounts import models as m >>> from django.contrib.auth.models import User >>> me = User.objects.get(pk=1) >>> me >>> messages_from_me = m.PersonalMessage.objects.filter(from_id = me, hide_from = False).order_by('-time','-pk') >>> messages_from_me.query.group_by=['-to_id_id'] I get the following error: Traceback (most recent call last): File """", line 1, in File ""/usr/local/lib/python2.6/dist-packages/django/db/models/query.py"", line 147, in __repr__ data = list(self[:REPR_OUTPUT_SIZE + 1]) File ""/usr/local/lib/python2.6/dist-packages/django/db/models/query.py"", line 162, in __len__ self._result_cache.extend(list(self._iter)) File ""/usr/local/lib/python2.6/dist-packages/django/db/models/query.py"", line 275, in iterator for row in self.query.results_iter(): File ""/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py"", line 206, in results_iter for rows in self.execute_sql(MULTI): File ""/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py"", line 1734, in execute_sql cursor.execute(sql, params) File ""/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py"", line 19, in execute return self.cursor.execute(sql, params) ProgrammingError: колонка ""accounts_personalmessage.id"" должна фигурировать в выражении GROUP BY или использоваться в агрегатной функции The last line is in Russian, it says something like column ""accounts_personalmessage.id"" should be in GROUP BY expression or should be used in aggregation function. The same code works normally for sqlite. ",,closed,Uncategorized,1.0,,invalid,,,Unreviewed,0,0,0,0,0,0