Re: Weird Character Ordering - Mailing list pgsql-general

From Richard Huxton
Subject Re: Weird Character Ordering
Date
Msg-id 200306051318.11752.dev@archonet.com
Whole thread Raw
In response to Weird Character Ordering  (Blair Robertson <brobertson@squiz.net>)
List 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

pgsql-general by date:

Previous
From: "Coby Beck"
Date:
Subject: implicit type conversions
Next
From: Bruno Wolff III
Date:
Subject: Re: regular expression question