Re: BUG #15317: Sort order error

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pahwa(dot)sumit(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, PG Bug reporting form <noreply(at)postgresql(dot)org>
Subject: Re: BUG #15317: Sort order error
Date: 2018-08-08 08:26:48
Message-ID: 7039133c-fe5b-4036-cba1-c66f24b2c607@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 08/08/18 09:53, PG Bug reporting form wrote:
> When I execute a query
> select 'ALEX DARGAY' > 'ALEXANDER';
> It should return false as output because ascii value of space is lower than
> ascii value of 'A'.
> But the output is true, which is incorrect.

The correct answer to that query depends on the current locale. You seem
to be assuming that POSIX / C locale is used. You can check the current
locale's collation order with "show lc_collate;". The locale support is
provided by the Operating System, so even if the locale is nominally the
same, e.g. "UK English", it might behave slightly differently on
different systems.

See the user manual, sections 23.1 Locale Support and 23.2 Collation
Support for more information:

https://www.postgresql.org/docs/10/static/locale.html
https://www.postgresql.org/docs/10/static/collation.html

- Heikki

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergei Kornilov 2018-08-08 08:53:33 Re: BUG #15318: ERROR: current transaction is aborted, commands ignored until end of transaction block
Previous Message PG Bug reporting form 2018-08-08 08:15:22 BUG #15318: ERROR: current transaction is aborted, commands ignored until end of transaction block