Collate issue on order by Danish chars

I am having a an issue where collate is not working the way I expect it to… b

// create table with Danish collate
CREATE TABLE foo (a STRING COLLATE da)

// insert one char
insert into foo (a) values ('æ' COLLATE da),('a' COLLATE da),('å' COLLATE da),('ø' COLLATE da);

// select -> all good!
select * from foo order by a;

// insert more than one char
insert into foo (a) values ('ææ' COLLATE da),('aa' COLLATE da),('åå' COLLATE da),('øø' COLLATE da);

// select -> not so good
select * from foo order by a;

Order comes out as:

+----+
| a  |
+----+
| a  |
| æ  |
| ææ |
| ø  |
| øø |
| å  |
| aa |
| åå |
+----+
(8 rows)

I would have expected:

+----+
| a  |
+----+
| a  |
| aa |
| æ  |
| ææ |
| ø  |
| øø |
| å  |
| åå |
+----+
(8 rows)

it is the “aa” that is incorrect… Or am i wrong?

/Jakob

I have reproduced your problem. I am not sure what to say about this, because I do not know the Danish language or its collation rules.

What I do notice however is that the order is different (and apparently correct) if I use the Swedish collation order.

CockoachDB is delegating collation processing to an external library (inside the Go language). We’d need to investigate if the the external library has the proper order, or perhaps has a different opinion about Danish somehow.

Could you create an issue on Github with your example? And mention that Swedish doesn’t seem to have this issue. You can cc me on that issue. Thank you

I know what the issue is… aa is same as å, so that is why it did it.

All good, no issue.

Thanks for checking!