How to create a Postgres database with a different locale?

  Kiến thức lập trình

I’m trying to create a new Postgres database with the following code:

CREATE DATABASE my_db
    WITH
    OWNER = admin
    ENCODING = 'UTF8'
    LC_COLLATE = 'en_GB.utf8'
    LC_CTYPE = 'en_GB.utf8'
    LOCALE_PROVIDER = 'libc'
    TABLESPACE = pg_default
    CONNECTION LIMIT = -1
    IS_TEMPLATE = False;

But it fails with the error: ERROR: The chosen LC_CTYPE setting requires encoding "LATIN9".encoding "UTF8" does not match locale "en_GB.utf8" This issue is discussed on SO but solutions are about a Linux system. I’m working in pgAdmin in Windows.

I have checked pg_collation and both en_GB.utf8 and en_US.utf8 (which works) are listed, but if I create a table in the pgAdmin GUI, the only options for collation and character type are C, POSIX and en_US.utf8.

Any idea how to make other locales usable?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT