Re: Howto change db cluster locale on-the-fly

From: Jakub Ouhrabka <kuba(at)comgate(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Howto change db cluster locale on-the-fly
Date: 2007-02-19 22:15:26
Message-ID: 45DA217E.7030407@comgate.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

> Hacking pg_control would be the hard part; you'll never get the CRC
> right if you do it manually. Possibly pg_resetxlog could be adapted
> to the purpose.

thanks for your valuable answer! I looked at pg_resetxlog.c but I'm no
pg internals' expert - would something like this work?

1) normally shut down database
2) hack pg_resetxlog to set locale to wanted value
3) run pg_resetxlog -f (rewrite pg_control - everything would be guessed
with the exception of overloaded locale)
4) start database

We won't miss any transactions and there won't be any inconsistency in
data because server was normally shut down, right?

Thanks,

Kuba

Tom Lane napsal(a):
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
>>> But I guess something like this would work:
>>> 1) drop all indexes on text/varchar columns
>>> 2) change cluster locale
>>> 3) create all indexes on text/varchar columns
>
>> You're going to miss the "name" columns, ie. every string index in
>> pg_catalog.
>
> But "name" is not locale-aware --- it just uses strcmp(). AFAIR there
> aren't any locale-dependent indexes in the system catalogs. So in
> principle you could hack pg_control, restart the postmaster, and then
> reindex every locale-dependent index. Hacking pg_control would be the
> hard part; you'll never get the CRC right if you do it manually. Possibly
> pg_resetxlog could be adapted to the purpose.
>
>> I'd suggest single user mode at least, and make backups!
>
> Yup, a filesystem backup would be a *real* good idea. Not to mention
> testing the procedure on a toy installation.
>
> regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-02-19 22:29:40 Re: [HACKERS] Deadlock with pg_dump?
Previous Message Bruce Momjian 2007-02-19 22:06:28 Re: libpq docs about PQfreemem