BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: ammmkilo(at)163(dot)com
Subject: BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
Date: 2024-07-31 04:47:23
Message-ID: 18560-c6c21c3b8d5c3f9b@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18560
Logged by: Hang ammmkilo
Email address: ammmkilo(at)163(dot)com
PostgreSQL version: 16.3
Operating system: ubuntu 20.04
Description:

```create table
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 INT NOT NULL, c1 CHAR(1) UNIQUE);
INSERT INTO t0 VALUES (0, '1');
INSERT INTO t0 VALUES (0, '');
```

---sql1
select ('' like ''),('1' like '1');

?column? | ?column?
----------+----------
t | t
(1 row)

---sql2
select c1,(c1 like c1) from t0;

c1 | ?column?
----+----------
1 | t
| f
(2 rows)

In sql1, the result of the (" like ") query returns true. In sql2 (c1 like
c1) the return value is false when c1 is ".
I think this is contradictory and there may be some bug between the 'like'
and the query column.


---select version():

version

---------------------------------------------------------------------------------------------------------------------
PostgreSQL 16.3 (Debian 16.3-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
(1 row)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Muhammad Waqas 2024-07-31 07:43:33 Re: Installer initialization failed
Previous Message Tender Wang 2024-07-31 02:34:01 Re: BUG #18559: Crash after detaching a partition concurrently from another session