Thread: Query to identify all collations in the current database that need to be refreshed
Query to identify all collations in the current database that need to be refreshed
From
PG Doc comments form
Date:
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/17/sql-altercollation.html Description: On the alter collation docs [1], it says "The following query can be used to identify all collations in the current database that need to be refreshed and the objects that depend on them" ``` SELECT pg_describe_object(refclassid, refobjid, refobjsubid) AS "Collation", pg_describe_object(classid, objid, objsubid) AS "Object" FROM pg_depend d JOIN pg_collation c ON refclassid = 'pg_collation'::regclass AND refobjid = c.oid WHERE c.collversion <> pg_collation_actual_version(c.oid) ORDER BY 1, 2; ``` This seems to be a bit optimistic, since in my postgres instance, the `default` collation has `collversion` set to `NULL` which would not pass the comparison. In addition, dependencies to `default` do not seem to be encoded, as ``` SELECT pg_describe_object(refclassid, refobjid, refobjsubid) AS "Collation", pg_describe_object(classid, objid, objsubid) AS "Object" FROM pg_depend d JOIN pg_collation c ON refclassid = 'pg_collation'::regclass AND refobjid = c.oid ``` returns an empty row set. It seems like the description of the query is inaccurate. [1] https://www.postgresql.org/docs/current/sql-altercollation.html#SQL-ALTERCOLLATION-NOTES