pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: ammmkilo@163.com
Subject: BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
Date: Wed, 31 Jul 2024 04:47:23 +0000
Message-ID: <18560-c6c21c3b8d5c3f9b@postgresql.org> (raw)

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)



view thread (5+ messages)  latest in thread

Message-ID: <18560-c6c21c3b8d5c3f9b@postgresql.org>
Permalink:  ../18560-c6c21c3b8d5c3f9b@postgresql.org/
Also on:    postgresql.org/message-id/18560-c6c21c3b8d5c3f9b@postgresql.org

 · 

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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, ammmkilo@163.com
  Subject: Re: BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
  In-Reply-To: <18560-c6c21c3b8d5c3f9b@postgresql.org>

* 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