Hi,

On Tue, 24 Jan 2023, Julian Gilbey wrote:
> 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.

While those are only warnings, you will actually get errors
when you try to create new databases: 
> createdb: error: database creation failed: ERROR:  template database 
> "template1" has a collation version mismatch

And those errors are relatively frequent for users of rolling releases
derived from Debian like Kali Linux. They even have a page for this:
https://www.kali.org/docs/troubleshooting/postgresql-collation-mismatch-error/

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.

What do you think Christoph?

Cheers,

PS: Not quite sure if there's a good CLI command to directly get the
"collation version".
-- 
  ⢀⣴⠾⠻⢶⣦⠀   Raphaël Hertzog <[email protected]>
  ⣾⠁⢠⠒⠀⣿⡁
  ⢿⡄⠘⠷⠚⠋    The Debian Handbook: https://debian-handbook.info/get/
  ⠈⠳⣄⠀⠀⠀⠀   Debian Long Term Support: https://deb.li/LTS

Reply via email to