Re: BUG #18857: Abnormal string comparison results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 2322370369(at)qq(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18857: Abnormal string comparison results
Date: 2025-03-20 14:46:15
Message-ID: 985480.1742481975@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-03-20 14:56:20 Re: BUG #18858: client does not support server version newer than 15.12 but actual version is 15.8.1
Previous Message PG Bug reporting form 2025-03-20 13:53:59 BUG #18859: ERROR: unexpected plan node type: 356