public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Marcin Gozdalik <[email protected]>
To: [email protected]
Subject: Re: Changing locale of an existing database
Date: Tue, 17 Jun 2025 09:55:14 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CADu1mRP=rTC2WX=-EWqCX-CWjp9q09xxuEkK=2Se3wx1HasSkQ@mail.gmail.com>
References: <CADu1mRP=rTC2WX=-EWqCX-CWjp9q09xxuEkK=2Se3wx1HasSkQ@mail.gmail.com>

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
[email protected]







view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Changing locale of an existing database
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox