WARNING: database "postgres" has a collation version mismatch
DETAIL: The database was created using collation version 2.35, but
the operating system provides version 2.36.
HINT: Rebuild all objects in this database that use the default
collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION,
or build PostgreSQL with the right library version.
createdb: error: database creation failed: ERROR: template database "template1" has a collation version mismatch
I think it would be nice if that operation could be automated.
With dpkg triggers, it's easy to schedule a script on the postgresql
package side when libc6 (or locales?) gets upgraded. We can record the
libc6 version at installation time, and compare the version in the trigger run, and if the major version has changed, then we run the required
ALTER DATABASE commands.
PS: Not quite sure if there's a good CLI command to directly get the "collation version".
Re: Raphael Hertzog
I think it would be nice if that operation could be automated.
With dpkg triggers, it's easy to schedule a script on the postgresql package side when libc6 (or locales?) gets upgraded. We can record the libc6 version at installation time, and compare the version in the trigger run, and if the major version has changed, then we run the required
ALTER DATABASE commands.
The correct default action is to reindex all text indexes. ALTER
DATABASE is just a shortcut for when you know that the collation has
not changed.
How can we determine if the collation information has changed between
two glibc releases? (cc Aurlien in case he knows)
I understand the correct default action is to reindex all text fields,
but arguably the "template1" and "template0" databases
are mostly empty and likely have only ascii content where the collation information has no impact (or rather almost 0% chance of having been modified), so it should still be safe to perform those operations on those databases no?
Hi,
On Thu, 24 Apr 2025, Christoph Berg wrote:
Re: Raphael Hertzog
I think it would be nice if that operation could be automated.
With dpkg triggers, it's easy to schedule a script on the postgresql package side when libc6 (or locales?) gets upgraded. We can record the libc6 version at installation time, and compare the version in the trigger
run, and if the major version has changed, then we run the required
ALTER DATABASE commands.
The correct default action is to reindex all text indexes. ALTER
DATABASE is just a shortcut for when you know that the collation has
not changed.
How can we determine if the collation information has changed between
two glibc releases? (cc Aurélien in case he knows)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 482 |
Nodes: | 16 (2 / 14) |
Uptime: | 53:43:08 |
Calls: | 9,566 |
Files: | 13,660 |
Messages: | 6,142,642 |