Check out the pg_collation_actual_version() function.
The PostgreSQL documentation for ALTER COLLATION seems to discuss this issue in the "Notes" section:
When using collations provided by the ICU library, the ICU-specific version of the collator is recorded in the system catalog when the collation object is created. When the collation is used, the current version is checked against the recorded version, and a warning is issued when there is a mismatch...
A change in collation definitions can lead to corrupt indexes and other problems because the database system relies on stored objects having a certain sort order. ...
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;
You will notice that the given query makes use of the pg_collation_actual_version() function, which is defined as:
pg_collation_actual_version returns the actual version of the collation object as it is currently installed in the operating system. If this is different from the value in
pg_collation.collversion, then objects depending on the collation might need to be rebuilt.