snippetsqlMinor
How to force Windows to support not supported LC_COLLATE and LC_TYPE in PostgreSQL?
Viewed 0 times
postgresqlforcelc_collatewindowshowandnotsupportedlc_typesupport
Problem
I have fresh installation of PostgreSQL 9.1.x. Unfortunately, I discovered that OS doesn't support
On all platforms, the collations named default, C, and POSIX are
available. Additional collations may be available depending on
operating system support.
Is a way, however to force Windows to support that locale ? I mean a patch, plugin or something.
LC_COLLATE = 'pl_PL.utf8' and LC_CTYPE = 'pl_PL.utf8'. I read in PostgreSQL documentation that:On all platforms, the collations named default, C, and POSIX are
available. Additional collations may be available depending on
operating system support.
Is a way, however to force Windows to support that locale ? I mean a patch, plugin or something.
Solution
On Windows, it's likely that the needed locale is already installed, it's just named differently than on Unix.
As an example, the following database creation appears to works fine for me with PG9.1 on my Windows XP, with its default locale
Also, a quick test of the sort order by submitting this query in UTF8 in this newly created database:
seems to output correct results:
s
ś
x
y
z
ź
ż
As an example, the following database creation appears to works fine for me with PG9.1 on my Windows XP, with its default locale
French_France.1252 and no additional language pack installed that I'd recall.CREATE DATABASE pldb
ENCODING = 'UTF8'
LC_COLLATE = 'Polish'
LC_CTYPE = 'Polish'
TEMPLATE=template0;Also, a quick test of the sort order by submitting this query in UTF8 in this newly created database:
select * from (values ('z'), ('ź'), ('ż'), ('s'), ('ś'), ('x'), ('y')) as letters order by 1;seems to output correct results:
s
ś
x
y
z
ź
ż
Code Snippets
CREATE DATABASE pldb
ENCODING = 'UTF8'
LC_COLLATE = 'Polish'
LC_CTYPE = 'Polish'
TEMPLATE=template0;select * from (values ('z'), ('ź'), ('ż'), ('s'), ('ś'), ('x'), ('y')) as letters order by 1;Context
StackExchange Database Administrators Q#23435, answer score: 7
Revisions (0)
No revisions yet.