pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 2322370369@qq.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18857: Abnormal string comparison results
Date: Thu, 20 Mar 2025 10:46:15 -0400
Message-ID: <985480.1742481975@sss.pgh.pa.us> (raw)
In-Reply-To: <18857-a9354c81af5b800d@postgresql.org>
References: <18857-a9354c81af5b800d@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> As shown in the example below, on the ASCII table ‘?’ is larger than ‘&’. I
> don't think ‘t’ should be returned here. In the MySQL database it does
> return 0.
> Is there some special consideration here?

Read about collations at

https://www.postgresql.org/docs/current/collation.html

You are probably using a non-C collation.  You could say

postgres=# SELECT ('?' <= '&*CcCV5' collate "C");
 ?column? 
----------
 f
(1 row)

but more likely you want to switch it at the database level.

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <985480.1742481975@sss.pgh.pa.us>
Permalink:  ../985480.1742481975@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/985480.1742481975@sss.pgh.pa.us

 · 

reply

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, 2322370369@qq.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18857: Abnormal string comparison results
  In-Reply-To: <985480.1742481975@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