Subject How to create properly a custom accent sensitive collation order?
Author Gabor Boros
Hi All,

I have a database with default UTF8 character set and UNICODE_CI collation:

CREATE DATABASE 'MYDB' PAGE_SIZE 4096 DEFAULT CHARACTER SET UTF8
COLLATION UNICODE_CI;

Execute the next script:

CREATE COLLATION UNICODE_CI_AS_HU FOR UTF8 FROM UNICODE_CI ACCENT
SENSITIVE 'LOCALE=hu_HU';

ALTER CHARACTER SET UTF8 SET DEFAULT COLLATION UNICODE_CI_AS_HU;

CREATE TABLE TABLE_1 (NAME VARCHAR(60));

INSERT INTO TABLE_1 VALUES ('Vál');
INSERT INTO TABLE_1 VALUES ('Val');
INSERT INTO TABLE_1 VALUES ('Vak');
INSERT INTO TABLE_1 VALUES ('Vac');
INSERT INTO TABLE_1 VALUES ('Vab');
INSERT INTO TABLE_1 VALUES ('Váb');

After that I want to get the ordered result:

SELECT NAME FROM TABLE_1 ORDER BY NAME

or

SELECT NAME FROM TABLE_1 ORDER BY NAME COLLATE UNICODE_CI_AS_HU

give the next result:

Vab
Váb
Vac
Vak
Val
Vál

but the expected is:

Vab
Vac
Vak
Val
Váb
Vál

What I am doing wrong?

Gabor