etianen / django-reversion

django-reversion is an extension to the Django web framework that provides version control for model instances.
https://django-reversion.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.03k stars 489 forks source link

#951 BUG SELECT DISTINCT ON expressions must match initial ORDER BY #952

Closed siddarta-weis closed 10 months ago

siddarta-weis commented 11 months ago

The commit in #951 broke in django 4.2.7 + postgresql, reverting to 5.0.6 works:

PostgreSQL has raised an error regarding the use of SELECT DISTINCT ON in conjunction with ORDER BY clauses.

_ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY expressions at character 21 STATEMENT: SELECT DISTINCT ON ("reversion_version"."object_id") "reversion_version"."id" FROM "reversion_version" WHERE ("reversion_version"."content_type_id" = 14 AND "reversion_version"."db" = 'default' AND NOT EXISTS(SELECT 1 AS "a" FROM "unidade_unidade" U0 WHERE U0."id" = ("reversion_version"."object_id")::bigint LIMIT 1)) ORDER BY "reversionversion"."id" ASC LIMIT 21

etianen commented 11 months ago

Thanks! Reverted and released as 5.0.8 🙇