From: Tom Lane <tgl@sss.pgh.pa.us>
To: patrick.van.dijk@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18523: String compare not consistent
Date: Wed, 26 Jun 2024 12:04:04 -0400
Message-ID: <1515722.1719417844@sss.pgh.pa.us> (raw)
In-Reply-To: <18523-d7b3cacb64d91cda@postgresql.org>
References: <18523-d7b3cacb64d91cda@postgresql.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, patrick.van.dijk@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18523: String compare not consistent
In-Reply-To: <1515722.1719417844@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox