How to setup a good collation?

From: Nagy László Zsolt <gandalf(at)shopzeus(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: How to setup a good collation?
Date: 2016-03-06 09:13:27
Message-ID: 56DBF4B7.1050200@shopzeus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Example database on a Unix system:

CREATE DATABASE test
TEMPLATE = template0
ENCODING = 'UTF8'
LC_COLLATE = 'hu_HU.UTF-8'
LC_CTYPE = 'hu_HU.UTF-8'
CONNECTION LIMIT = -1;
\c test
create table a (name text collate "hu_HU.UTF-8");
insert into a values ('a');
insert into a values ('á');
insert into a values ('Á');
insert into a values ('b');
insert into a values ('e');
insert into a values ('é');
insert into a values ('É');
insert into a values ('o');
insert into a values ('ó');
insert into a values ('ö');
insert into a values ('U');
insert into a values ('Ü');
insert into a values ('Z');

select name from a order by upper(name) asc;

Results in:

"a"
"b"
"e"
"o"
"U"
"Z"
"á"
"Á"
"é"
"É"
"ó"
"ö"
"Ü"

Which is bad. The good order should be the following:

"a"
"á"
"Á"
"b"
"e"
"é"
"É"
"o"
"ó"
"ö"
"U"
"Ü"
"Z"

What is wrong with my collaction setup?

Thanks,

Laszlo

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Nagy László Zsolt 2016-03-06 09:40:31 Re: How to setup a good collation?
Previous Message Kevin Grittner 2016-03-05 16:12:40 Re: Getting OOM errors from PostgreSQL