Re: Weird Character Ordering

From: Richard Huxton <dev(at)archonet(dot)com>
To: Blair Robertson <brobertson(at)squiz(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Weird Character Ordering
Date: 2003-06-05 12:18:11
Message-ID: 200306051318.11752.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 05 Jun 2003 7:50 am, Blair Robertson wrote:
> Gday,
>
> I am not sure if this should be sent here or to the bugs list - mainly
> because I am not sure if this can be solved by some setting or not.
>
> When the colon character, ':', is compared the zero character, '0',
> it is stated to be the lower character, even though zero's ascii value
> is 48 and colon's is 58.
>
> This is occurs for with MAX(), ORDER BY and normal comparison with '<'
> operator.

> blair_test=> select ascii('0'), ascii(':'), ascii('0') < ascii(':');
> ascii | ascii | ?column?
> -------+-------+----------
> 48 | 58 | t
> (1 row)
>
> blair_test=> select ascii('0'), ascii(':'), '0' < ':';
> ascii | ascii | ?column?
> -------+-------+----------
> 48 | 58 | f
> (1 row)

Welcome to the wonderful world of locales. It might be a bug, but is probably
just a rule of the sorting for your current locale. See the "localization"
chapter of the Administrator's manual and thousands of posts in the mailing
archives.

Briefly, check your "LC_xxx" environment settings and try "show all" in psql.
Your default locale gets set when you initdb, and probably picked up your
OS's settings.
--
Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nigel J. Andrews 2003-06-05 13:38:43 large objects
Previous Message Bruno Wolff III 2003-06-05 12:03:30 Re: regular expression question