#11332: Group by doesn't work properly with PosgreSQL ------------------------------------+--------------------------------------- Reporter: Loststylus | Owner: nobody Status: new | Milestone: Component: Uncategorized | Version: 1.0 Resolution: | Keywords: Stage: Unreviewed | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ------------------------------------+--------------------------------------- Comment (by Loststylus):
Sorry, missed the <code> tag. Here it goes with the normal formatting: {{{ >>>from accounts import models as m >>>from django.contrib.auth.models import User me = User.objects.get(pk=1) me <User: root> >>>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'] Traceback (most recent call last): File "<console>", line 1, in <module> 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 или использоваться в агрегатной функции }}} I get the following error: -- Ticket URL: <http://code.djangoproject.com/ticket/11332#comment:2> 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 django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---