I tried to create columns with tr_TR and got this error.
error: collation “tr_tr” for encoding “UTF8” does not exist
I tried to create columns with tr_TR and got this error.
error: collation “tr_tr” for encoding “UTF8” does not exist
If you need to create databases with different encodings you have to take the “template0” template which is not default.
You can create a database with tr_tr like this example:
defaultdb=> CREATE DATABASE "turkishdb" ENCODING 'UTF-8' LC_COLLATE 'tr_TR.UTF-8' TEMPLATE template0;
CREATE DATABASE
defaultdb=> \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
_aiven | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =T/postgres +
| | | | | | | | postgres=CTc/postgres
defaultdb | avnadmin | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
template0 | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
turkishdb | avnadmin | UTF8 | libc | tr_TR.UTF-8 | en_US.UTF-8 | | |
(5 rows)
defaultdb=>
Please be aware that in this example I only changed the collate. All other locale settings can added here as well.
For more detailed information you can use the official PostgreSQL documentation or just ask here
Cheers
Dirk