Search Postgresql Archives

Re: Losing my latin on Ordering...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2023-02-14 at 13:06 +0100, Dominique Devienne wrote:
> > Sure, just make sure to use the definition of C that uses UTF-8 encoding
> > (I think it's typically called C.UTF-8).
>  
> OK, so for new DBs, sounds like we need to
> 
> CREATE DATABASE ... WITH LOCALE 'C.UTF-8' ENCODING UTF8 
> 
> Correct?

Collations are identifiers, so it has to be double quotes.
The name depends on the operating system; if that is Unix-like,
you can run "locale -a" to get all available locales.

On my system it would be

CREATE DATABASE x TEMPLATE template0 LOCALE "C.utf8" ENCODING UTF8;

> But what about existing DBs? Can the collation be changed a posteriori?
> ALTER DATABASE does not seem to support the same options.
> 
> We don't want to have to sprinkle COLLATE "C" all over the place in the code.
> And there are quite a few DBs out there already. What to do about them?

The only option is dump/restore.

A changed collation means changed indexes, so there is no better option.

Yours,
Laurenz Albe






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux