From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | 2322370369(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18857: Abnormal string comparison results |
Date: | 2025-03-20 15:00:58 |
Message-ID: | Z9wtqonXuI2DL5vo@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Mar 20, 2025 at 09:53:32AM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18857
> Logged by: dlyixue Xu
> Email address: 2322370369(at)qq(dot)com
> PostgreSQL version: 17.3
> Operating system: Ubuntu 22.04
> Description:
>
> When I use a conditional query, I find that it returns results that are not
> as expected. After checking, I found that there is a problem with string
> comparison here.
> 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?
>
> postgres=# SELECT ('?' <= '&*CcCV5');
> ?column?
> ----------
> t
I think your collation is ignoring punctuation:
SELECT '?Z' <= '&A';
?column?
----------
f
SELECT '?A' <= '&Z';
?column?
----------
t
SELECT '?' <= '&*CcCV5' COLLATE "C";
?column?
----------
f
--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
From | Date | Subject | |
---|---|---|---|
Next Message | Ben Caspi | 2025-03-20 15:14:13 | PostgreSQL v15.12 fails to perform PG_UPGRADE from v13 and v9 on Windows |
Previous 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 |