Hi Aaron,

I think this could be related to the version of your PostgreSQL server.

Django 1.9 dropped support for PostgreSQL 9.0[1] which doesn't support
GROUP BY selected primary keys[2].

Cheers,
Simon

[1] 
https://docs.djangoproject.com/en/1.9/releases/1.9/#dropped-support-for-postgresql-9-0
[2] 
https://github.com/django/django/commit/dc27f3ee0c3eb9bb17d6cb764788eeaf73a371d7

Le lundi 29 février 2016 15:56:07 UTC-5, Aaron C. de Bruyn a écrit :
>
> A simple annotation broke when I migrated by app from Django 1.8.x to 
> 1.9.2, and I can't figure out why for the life of me.
>
> Calling Company.objects.all().annotate(ticketcount=Count('srservice'))
>
> throws an error "ProgrammingError: column "company.owner_id" must appear 
> in the GROUP BY clause or be used in an aggregate function"
>
> Rolling back to Django 1.8.5 fixes the problem.
> The DB backend is Postgres.
>
> Please ignore the horrible DB schema.  It's not mine.  It's an 
> introspection of a horrible Windows ticketing app.
>
> Models and traceback here: 
> https://gist.github.com/darkpixel/e8f494038d5192225901
>
> Am I missing something?
>
> -A
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c40f831-b730-40c5-9009-7cfac291e45f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to