Fellow users, I have an unmanaged model that references a view in my PostgreSQL 9.5 backend. I am trying to apply an annotation through the ORM in that model's manager. Unfortunately, I am getting an error that some fields "must appear in the GROUP BY clause or be used in an aggregate function."
Upon further investigation, it appears that I need a PRIMARY KEY in the backend to avoid having to include columns in a GROUP BY clause, but PostgreSQL does not allow for such constraints to be added to a VIEW. The "id" column is just a row_number(). I was wondering how anyone else handled this issue. Thanks! -- 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 [email protected]. To post to this group, send email to [email protected]. 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/32e312a8f0284745855651d683e3c499%40ISS1.ISS.LOCAL. For more options, visit https://groups.google.com/d/optout.

