DB Locale
Hi, I encountered an issue when restoring database dump into neon, fails with
the LC_COLLATE of the DB that created the dump is en_US.UTF8 (default in cloud SQL)
will you support different locales at some point (I assume that's the issue), or is there any way to workaround?
5 Replies
stormy-gold•16mo ago
Hey @molek,
Create a database with desired encoding:
create database russian_icu_db icu_locale 'ru-x-icu' locale_provider='icu' template template0;
Does that help?conscious-sapphireOP•16mo ago
hey @Rishi Raj Jain nope, I've tried that
ambitious-aqua•16mo ago
Neon doesnt currently support directly changing the db encoding, however you may be able to use ICU custom collations to make it work: https://neon.tech/docs/reference/compatibility#database-encoding
CREATE COLLATION russian (provider = icu, locale = 'ru');
CREATE TABLE books (id int, title text COLLATE "russian");
ah wait a sec - there's some internal discussion of a better way to do it.
stormy-gold•16mo ago
did you get a chance at the command I shared? does that work for you?
optimistic-gold•16mo ago
By default, a Neon database is created with the C locale, and I see this in the ltree docs:
"Valid alphanumeric character ranges are dependent on the database locale. For example, in C locale, the characters A-Za-z0-9_- are allowed." A possible solution, if creating the targetdb with a ICU ru locale doesn't work, might be to rename columns before dumping using the supported characters mentioned above.