Thread: Ensuring same collation on OSX and Linux?

Ensuring same collation on OSX and Linux?

From
John Norman
Date:
I observe that with the apparently same locale settings on OSX and
Linux (stock Ubuntu 9.10), that the collations are different.

Here's my sample query:

select name from (
    select 'A' as name
        union
    select 'a' as name
) tab
order by name asc

OSX: LC_COLLATE="en_US.UTF-8"
Result:

name
A
a

Linux: LC_COLLATE="en_US.UTF-8"

name
a
A

Also, I note that this is system-wide. If I sort a text file with
contents of A and a on separate lines . . . using /usr/bin/sort . . .
I get the same result.

Maybe the UTF8 collations on OSX (or Linux) are broken?

John

Re: Ensuring same collation on OSX and Linux?

From
Tom Lane
Date:
John Norman <john@7fff.com> writes:
> I observe that with the apparently same locale settings on OSX and
> Linux (stock Ubuntu 9.10), that the collations are different.
> ...
> Maybe the UTF8 collations on OSX (or Linux) are broken?

Yeah, OS X's support for UTF8 locales is pretty broken :-(.  You
can find previous discussions about that in the PG archives --- there
was one just a few days ago.

            regards, tom lane