Thread: problem with nasty latin2 sorting

problem with nasty latin2 sorting

From
Anna Domachowska
Date:
Hello,
I've got a problem with sorting polish words in postgresql 7.4.2

For example, I've got couple of polish cities in my table 'x', results 
of sorting are:
(select city from x order by city asc)

Bydgoszcz
Gdańsk
Iława
Łódź
Żarnów
Malbork
Warszawa

So "Żarnów" is placed in wrong place, because it should be found after 
letter "Z" ??

What's wrong? Is there any patch to fix this? Does anybody had similar 
problem?
I belive that postgres was compiled with "--enable-locale", and the 
right locale is set.

Anna Domachowska


Re: problem with nasty latin2 sorting

From
Greg Stark
Date:
Anna Domachowska <anka@zjednoczenie.com> writes:

> So "¯arnów" is placed in wrong place, because it should be found after letter
> "Z" ??
> 
> What's wrong? Is there any patch to fix this? Does anybody had similar problem?
> I belive that postgres was compiled with "--enable-locale", and the right
> locale is set.

What does "show lc_collate" say?
What does \l show in psql?

what do you get on your machine if you save that same list in a file and run
"sort" on it on the commandline set (with LC_COLLATE set to the same value as
above)?

-- 
greg



Re: problem with nasty latin2 sorting

From
Tom Lane
Date:
Anna Domachowska <anka@zjednoczenie.com> writes:
> I've got a problem with sorting polish words in postgresql 7.4.2
> ...
> I belive that postgres was compiled with "--enable-locale", and the
> right locale is set.

How sure are you of that?  This sure sounds like a wrong-locale problem
to me.  Try "show lc_collate" and "show server_encoding".

            regards, tom lane