How to create DB with Latin9 locale - postgresql

I have a new server running Postgres Linux Version 12.9 (2021-12-13), and I want to create a DB with these options:
CREATE DATABASE et_base WITH
ENCODING 'LATIN9' LC_COLLATE = 'fr_FR.iso885915#euro'
LC_CTYPE = 'fr_FR.iso885915#euro' TEMPLATE=template0.....
But I get this error message:
ERROR: invalid locale name: "fr_FR.iso885915#euro"

Related

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
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.

Locale not recognised Error while creating Datasource (connecting with oracle db)

I am using Jboss as app server (RHEL-7). I have to create datasource to connect with oracle (Oracle Database 12c Enterprise Edition Release 12.1.0.2.0) db.
To create DS, using ojdbc driver. When I try to do test connection, in logs I am getting "Locale not recognised" error. To be specific getting below error in logs:
converted JNDI name [java:comp/env/user.country] not found - trying original name [user.country]. javax.naming.NameNotFoundException: env/user.country -- service jboss.naming.context.java.module.iconnect-worklist.iconnect-worklist.env."user.country"
when I run locale command :
locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG==en_IN.UTF-8 LC_CTYPE="=en_IN.UTF-8" LC_NUMERIC="=en_IN.UTF-8" LC_TIME="=en_IN.UTF-8"LC_COLLATE="=en_IN.UTF-8" LC_MONETARY="=en_IN.UTF-8" LC_MESSAGES="=en_IN.UTF-8" LC_PAPER="=en_IN.UTF-8" LC_NAME="=en_IN.UTF-8" LC_ADDRESS="=en_IN.UTF-8" LC_TELEPHONE="=en_IN.UTF-8" LC_MEASUREMENT="=en_IN.UTF-8" LC_IDENTIFICATION="=en_IN.UTF-8" LC_ALL=
when I run java -XshowSettings command:
`sun.os.patch.level = unknown
user.country = US
user.dir = /home/appadmin
user.home = /home/appadmin
user.language = en
user.name = appadmin
user.timezone =
Locale settings:
default locale = English
default display locale = English (United States)
default format locale = English (United States)`
Please help me with this issue.

Get und-x-icu as collation and character type in Postgres 10 and win server 2008

I have successfully installed Postgres 10 in a Windows Server 2008 R2 standard, 64 bit.
I am trying to create a new database that has LC_COLLATE = 'und-x-icu' and LC_CTYPE = 'und-x-icu' with the following SQL
CREATE DATABASE hey
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'und-x-icu'
LC_CTYPE = 'und-x-icu'
TABLESPACE = pg_default
CONNECTION LIMIT = -1
TEMPLATE = template0
;
I get ERROR: invalid locale name: "und-x-icu" SQL state: 42809.
But the SELECT * FROM pg_collation; clearly shows und-x-icu.
The same SQL works on my laptop (windows 10).
I did select locale : C while installing on the server, I did not remember what I selected as a locale while installing on the laptop.
How can I make this work on win server 2008 and get und-x-icu?
The documentation does not seem to mention that restriction, but you cannot use ICU collations in CREATE DATABASE.
This may be improved in the future, but for now there is no way to have an ICU collation as the default collation.

Postgresql: could not connect to server: No such file or directory

Ubuntu 14
I install postgresql server on remote server(digitalocean).
Run command psql and display errors:
postgres#ubuntu-512mb-fra1-01:/home/deploy$ psql
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "be_BY.UTF-8",
LC_ADDRESS = "be_BY.UTF-8",
LC_MONETARY = "be_BY.UTF-8",
LC_NUMERIC = "be_BY.UTF-8",
LC_TELEPHONE = "be_BY.UTF-8",
LC_IDENTIFICATION = "be_BY.UTF-8",
LC_MEASUREMENT = "be_BY.UTF-8",
LC_TIME = "be_BY.UTF-8",
LC_NAME = "be_BY.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I want reload postgresql server, run command service postgresql start --force
* No PostgreSQL clusters exist; see "man pg_createcluster"
I think problem with locale setting. But how solve this error?
locale warning won't prevent psql from connecting. Read https://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue on this.
No PostgreSQL clusters exist
means that you probably did not create a cluster. Run smth like pg_createcluster -p 2345 9.5 test to create a test cluster, or better read man pg_createcluster as Ubuntu suggested
Walk this way
Find the cluster
pg_lsclusters
Drop your cluster (Use the information from above)
pg_dropcluster --stop 9.3 main
Create the cluster anew
pg_createcluster --locale en_US.UTF-8 --start 9.3 main
Login to postgres
sudo -u postgres psql
And check locales
show LC_COLLATE;
show LC_CTYPE;
-

How to see cyrillic symbols in PostgreSQL errors?

I have a PostgreSQL on Windows 7 machine. And here my data base script:
CREATE DATABASE usersdb
WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'Russian_Russia.1251'
LC_CTYPE = 'Russian_Russia.1251'
CONNECTION LIMIT = -1;
My problem in that i see unreadable error in Jetty/Tomcat:
Caused by: org.postgresql.util.PSQLException: ?????: ???????????? "test_user" ?? ?????? ???????? ??????????? (?? ??????)
I try create new db in pgAdmin but there are only LC_COLLATE = 'Russian_Russia.1251' and LC_CTYPE = 'Russian_Russia.1251' i can chose.
How can i solve this problem?
The first place to look, of course, are in the PostgreSQL logs. Those may be better handled than your Jetty/Tomcat instance.
The second question is what client encoding is set. You may want to (via jdbc):
show client_encoding;
Finally lc_messages may need to be adjusted.