#27241: Annotate doesn't work with PostgreSQL views anymore -------------------------------------+------------------------------------- Reporter: jaap3 | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: master (models, ORM) | Severity: Normal | Resolution: Keywords: postgresql view | Triage Stage: Accepted aggregate annotate | Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by jaap3): As far as Django is concerned these views do have a primary key (there's a id field, it even has a unique index). The problem is that at the database level this field isn't, and cannot, have a primary key constraint. Without a **real** primary key Postgres cannot group by primary key only, since they don't exist. This is what happens if you try to add a PK to a (materialized) view: {{{ => ALTER MATERIALIZED VIEW my_view ADD CONSTRAINT my_view_pkey PRIMARY KEY (id); ERROR: "my_view" is not a table }}} -- Ticket URL: <https://code.djangoproject.com/ticket/27241#comment:10> Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.da63dc2f2983fa68745754ad35836bb1%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.