BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
Date
Msg-id 18560-c6c21c3b8d5c3f9b@postgresql.org
Whole thread Raw
Responses Re: BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
Re: BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18560
Logged by:          Hang ammmkilo
Email address:      ammmkilo@163.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)


pgsql-bugs by date:

Previous
From: Tender Wang
Date:
Subject: Re: BUG #18559: Crash after detaching a partition concurrently from another session
Next
From: Muhammad Waqas
Date:
Subject: Re: Installer initialization failed