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

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: ammmkilo(at)163(dot)com
Subject: Re: BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
Date: 2024-07-31 09:19:59
Message-ID: CAJ7c6TP4Szizc70zDCLrLkj8cSnCGuk4eky-WF_g4bFbmVqczw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

> 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.

Actually the result is consistent:

```
SELECT c1, c1 = ' ' FROM t0;
c1 | ?column?
----+----------
1 | f
| t
(2 rows)

select ' '::char(1) like ' '::char(1);
?column?
----------
f
(1 row)
```

Although I find it puzzling too that LIKE operators for CHAR(1) and
TEXT work differently. Not 100% sure if this is intended.

Thoughts?

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2024-07-31 09:46:46 Re: BUG #18560: Inconsistent Behavior of PostgreSQL 'LIKE' Operator
Previous Message Muhammad Waqas 2024-07-31 07:43:33 Re: Installer initialization failed