Re: BUG #18523: String compare not consistent

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #18523: String compare not consistent
Дата
Msg-id 1515722.1719417844@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #18523: String compare not consistent  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> When I try the following on a Azure/Linux version of PostgreSQL i see some
> strange results that are not correct.
> On Windows the behavior is correct.

"Correct" is in the eye of the beholder, and non-C collations
tend to act in ways far more complicated than you seem to expect.
Check the locale settings on the two machines; unless they are
both "C", there's not really any guarantee of consistency
between Windows and anybody else.

As a demonstration that this isn't some Postgres-specific
weirdness, you can try asking sort(1) what it thinks.
On a RHEL8 machine I get

$ echo -e '|\n0' | LANG=C sort
0
|
$ echo -e '|1\n01' | LANG=C sort
01
|1
$ echo -e '|\n0' | LANG=en_US.utf8 sort
|
0
$ echo -e '|1\n01' | LANG=en_US.utf8 sort
01
|1

and I'd expect the same from any Linux machine with a similar
vintage of glibc.

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: BUG #18523: String compare not consistent
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: BUG #18523: String compare not consistent