Changing locale of an existing database

From: Marcin Gozdalik <gozdal(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Changing locale of an existing database
Date: 2025-06-17 16:20:04
Message-ID: CADu1mRP=rTC2WX=-EWqCX-CWjp9q09xxuEkK=2Se3wx1HasSkQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I am using PostgreSQL 17 and would like to take advantage of performance
and stability across OS updates of builtin C.UTF-8 locale.
I have a cluster with a DB created with en_US.UTF-8 libc locale. I would
like to migrate the DB to C.UTF-8. Ideally there'd be an "ALTER DATABASE
... SET LOCALE ..." command that would take care of it but it seems it
doesn't exist. I was thinking that I could change the collation of all
TEXT/CHAR/VARCHAR columns in all the tables to pg_c_utf8, REINDEX all those
columns and change the default locale in the pg_database table.

Is it a sensible plan? Am I missing some steps? I can't find any reference
to anybody doing that before or discouraging it.

Thanks,
Marcin

--
Marcin Gozdalik

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dimitrios Apostolou 2025-06-17 16:30:51 Re: Performance issues during pg_restore -j with big partitioned table
Previous Message Phillip Diffley 2025-06-17 09:49:15 Re: Stably escaping an identifier