Sort order is different on Windows and Linux

Started by Robert Willeover 22 years ago3 messagesgeneral
Jump to latest
#1Robert Wille
a2om6sy02@sneakemail.com

I have found that the sort order is different on Windows and Linux (same version of Postgres). On Windows, it sorts in what appears to be normal ASCII order. On Linux, lowercase comes before uppercase, and all non-alphanumerics appear to come before all alphanumerics. I really need it to sort on Linux the same as it does on Windows. The docs seem to imply that I can simply set the LANG environment variable to C to get an ASCII sort order, but that seem to make a difference. How do I change the sort order?

Thanks in advance.

Robert

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Robert Wille (#1)
Re: Sort order is different on Windows and Linux

On Wed, 17 Sep 2003, Robert Wille wrote:

I have found that the sort order is different on Windows and Linux (same
version of Postgres). On Windows, it sorts in what appears to be normal
ASCII order. On Linux, lowercase comes before uppercase, and all
non-alphanumerics appear to come before all alphanumerics. I really need
it to sort on Linux the same as it does on Windows. The docs seem to
imply that I can simply set the LANG environment variable to C to get an
ASCII sort order, but that seem to make a difference. How do I change
the sort order?

You need to have the database initdb'd with the appropriate collation set
in LC_COLLATE. Changing LANG/LC_COLLATE after the fact won't help (in
recent versions anyway).

#3Robert Wille
a2om6sy02@sneakemail.com
In reply to: Robert Wille (#1)
Re: Sort order is different on Windows and Linux

Do I simply "export LC_COLLATE=C" before I initdb, or do I pass it as a
parameter?

Show quoted text

On Wed, 17 Sep 2003, Robert Wille wrote:

I have found that the sort order is different on Windows and Linux (same
version of Postgres). On Windows, it sorts in what appears to be normal
ASCII order. On Linux, lowercase comes before uppercase, and all
non-alphanumerics appear to come before all alphanumerics. I really need
it to sort on Linux the same as it does on Windows. The docs seem to
imply that I can simply set the LANG environment variable to C to get an
ASCII sort order, but that seem to make a difference. How do I change
the sort order?

You need to have the database initdb'd with the appropriate collation set
in LC_COLLATE. Changing LANG/LC_COLLATE after the fact won't help (in
recent versions anyway).