Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sMV7x-002hhc-TZ for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Jun 2024 16:04:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sMV7w-005Klr-9y for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Jun 2024 16:04:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sMV7v-005Klj-WD for pgsql-bugs@lists.postgresql.org; Wed, 26 Jun 2024 16:04:08 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sMV7t-003FSJ-PI for pgsql-bugs@lists.postgresql.org; Wed, 26 Jun 2024 16:04:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 45QG44Pb1515723; Wed, 26 Jun 2024 12:04:04 -0400 From: Tom Lane To: patrick.van.dijk@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18523: String compare not consistent In-reply-to: <18523-d7b3cacb64d91cda@postgresql.org> References: <18523-d7b3cacb64d91cda@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 26 Jun 2024 09:43:42 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1515721.1719417844.1@sss.pgh.pa.us> Date: Wed, 26 Jun 2024 12:04:04 -0400 Message-ID: <1515722.1719417844@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form 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