NehaS
NehaS

Reputation: 23

Adding COLLATION in postgres

I am migrating data from SQL Server to Postgres. Since Postgres is case-sensitive, I am trying to add case-insensitive COLLATION but it is failing with the below error -

ERROR: could not create locale "en-u-ks-primary": No such file or directory DETAIL: The operating system could not find any locale data for the locale name "en-u-ks-primary". SQL state: 22023

CREATE COLLATION main.case_insensitive_collation (LC_COLLATE = 'en-u-ks-primary',
        LC_CTYPE = 'en-u-ks-primary'
        PROVIDER = icu,
        DETERMINISTIC = False
    );

Checked the version of postgres -

SELECT version();

"PostgreSQL 12.5 on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit"

Any idea on how can I fix this or get this working ?

Thanks in advance,

Neha

Upvotes: 0

Views: 478

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247625

Your collation definition is wrong. It should be something like

CREATE COLLATION english_ci (
   PROVIDER = icu,
   LOCALE = 'en-u-ks-level2',
   DETERMINISTIC = FALSE
);

Here is an article that has some information about that.

Upvotes: 0

Related Questions