Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In PostgreSQL on Windows what effect does the locale have on a database itself

I have a database that has been created on a database server that was installed with "Default Locale" selected where asked for "Select the locale to be used by the new database cluster". It should have been set to a specific locale. Can I just change that afterwards, or do I have to create the database from scratch?

like image 833
Franz Thomsen Avatar asked Dec 20 '22 01:12

Franz Thomsen


1 Answers

It affects the text encoding ("code page") chosen for the DB, as well as the collation (sort order) used for text.

Changing either requires that you dump the database, drop it, re-create it and restore a dump.

When creating the database you can specify a specific ENCODING, LC_CTYPE, LC_COLLATE etc to override the DB-system-wide defaults. You must use TEMPLATE template0 if you want to change the encoding when creating a DB.

like image 190
Craig Ringer Avatar answered Feb 02 '23 00:02

Craig Ringer