Change culture in database
hello. Can you tell me how to change the database culture? I want to do this because the lower function in my database does not work with Russian letters right now. And it says in stackoverflow that to do this, you need to change the culture in the database

8 Replies
rising-crimson•2y ago
I attempted to create a database with Russian locale:
It failed, so I'm asking internally about this.
other-emeraldOP•2y ago
thank you so much ! :)
It would be great if you added the option to select the database culture directly on the site when creating the database
rising-crimson•2y ago
Unfortunately this dosen't sound like something we will add in the short-term. Maybe you store a lowercase version of the data, or the citext extension could help? https://neon.tech/docs/extensions/citext
Neon
The citext Extension - Neon Docs
The citext extension in PostgreSQL provides a case insensitive data type for text. This is particularly useful in scenarios where the case of text data should not affect queries, such as usernames or ...
other-emeraldOP•2y ago
as I wrote above, the "lower" function does not work, so most likely it will not work either. But it needs to be checked. Anyway, thanks for the advice!

plain-purple•2y ago
Hi, yeah, we don't support changing the database encoding, but we do support ICU custom collations. Is that helpful to you in this case?
Please see: https://neon.tech/docs/reference/compatibility#database-encoding
Russian example:
-- Create a custom collation for Russian language using ICU (International Components for Unicode) provider
CREATE COLLATION russian (provider = icu, locale = 'ru_RU');
-- Create a table 'books' with a 'title' column using the Russian collation
CREATE TABLE books (
id SERIAL PRIMARY KEY,
title TEXT COLLATE "russian"
);
Neon
Postgres compatibility - Neon Docs
Neon is Postgres. However, as a managed Postgres service, there are some differences you should be aware of. Postgres versions Neon supports Postgres 14, 15, and 16. You can select the Postgres versio...
other-emeraldOP•2y ago
thank you !
equal-aqua•2y ago
@zero973
The other way is to create a database with desired encoding:
create database russian_icu_db icu_locale 'ru-x-icu' locale_provider='icu' template template0;other-emeraldOP•2y ago
thank u