Thread: order by differences: locale problem?

order by differences: locale problem?

From
Raphael Bauduin
Date:
Hi,

I have ordering differences between 2 servers, running both the same
linux distribution (debian), the same postgresql server (8.2.9, though
one was compiled, and the order installed with debian packages).
Both have differences in ordering, and I don't know which settings
influence this behaviour:

Here's an example:

Server 1: expected behaviour:

select 'About' as n union select 'arrow' as n union select 'Bold' as n
union select 'sequence' as n order by n;
    n
----------
 About
 Bold
 arrow
 sequence



Server 2:  undesired behaviour: it sorts results case unsensitive

select 'About' as n union select 'arrow' as n union select 'Bold' as n
union select 'sequence' as n order by n;
    n
----------
 About
 arrow
 Bold
 sequence


What settings do I have to change to have the same behaviour on both servers?

Thanks in advance.

Raphaël


--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

Re: order by differences: locale problem?

From
Tom Lane
Date:
Raphael Bauduin <rblists@gmail.com> writes:
> I have ordering differences between 2 servers, running both the same
> linux distribution (debian), the same postgresql server (8.2.9, though
> one was compiled, and the order installed with debian packages).
> Both have differences in ordering, and I don't know which settings
> influence this behaviour:

lc_collate and lc_ctype.  Unfortunately the only way to change these
is to re-initdb.  (See the --locale switch to initdb.)

            regards, tom lane