Re: Changing locale of an existing database - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Changing locale of an existing database
Date
Msg-id 603f35e6-32b2-4044-bbfb-5e70bba5164b@aklaver.com
Whole thread Raw
In response to Changing locale of an existing database  (Marcin Gozdalik <gozdal@gmail.com>)
List pgsql-general
On 6/17/25 09:20, Marcin Gozdalik wrote:
> 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.

How big a database are we talking about?

To me it would seem easier to create a new database with new locale and 
do either a pg_dump/pg_restore or logical replication to the new 
instance. Of course this may depend on the answer to the question above.

> 
> Thanks,
> Marcin
> 
> -- 
> Marcin Gozdalik

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: Dimitrios Apostolou
Date:
Subject: Re: Performance issues during pg_restore -j with big partitioned table
Next
From: Masahiko Sawada
Date:
Subject: Re: Logical Replication Memory Allocation Error - "invalid memory alloc request size"