To compare collation-versions of a Postgresql-16 DB-cluster with respective OS collation versions
select oid, collname, collversion "orig_version",
pg_collation_actual_version(oid) "curr_version" from pg_collation
Example: Debian Upgrade from 11/bullseye to 12/bookworm operating a hot-standby PostgreSQL DB
Streaming-replication source on Debian11 bullseye
SQL_prompt=# select oid, collname, collversion "orig_version",
pg_collation_actual_version(oid) "curr_version" from pg_collation;
| oid |
collname |
orig_version |
curr_version |
| 100 |
default |
|
|
| 950 |
C |
|
|
| 951 |
POSIX |
|
|
| 962 |
ucs_basic |
|
|
| 963 |
unicode |
153.14 |
153.14 |
| 12344 |
C.UTF-8 |
|
|
| 12350 |
en_US.utf8 |
2.31 |
2.31 |
| 12352 |
en_US |
2.31 |
2.31 |
Streaming replication target on Debian12/bookworm
SQL_prompt=# select oid, collname, collversion "orig_version",
pg_collation_actual_version(oid) "curr_version" from pg_collation;
| oid |
collname |
orig_version |
curr_version |
| 100 |
default |
|
|
| 950 |
C |
|
|
| 951 |
POSIX |
|
|
| 962 |
ucs_basic |
|
|
| 963 |
unicode |
153.14 |
153.120 |
| 12344 |
C.UTF-8 |
|
|
| 12350 |
en_US.utf8 |
2.31 |
2.36 |
| 12352 |
en_US |
2.31 |
2.36 |
Hence
After promoting the replication target, I expect log-entries like:
WARNING: database "mydb" has a collation version mismatch
DETAIL: The database was created using collation version 2.31,
but the operating system provides version 2.36.
HINT: Rebuild all objects in this database that use the default
collation and run ALTER DATABASE mydb REFRESH COLLATION VERSION
or build PostgreSQL with the right library version.