RE: BUG #18218: NOT LIKE ANY returns same result as LIKE ANY when array items are wrapped into E''

From: Orlov Aleksej <al(dot)orlov(at)cft(dot)ru>
To: "baurzhansahariev(at)gmail(dot)com" <baurzhansahariev(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: RE: BUG #18218: NOT LIKE ANY returns same result as LIKE ANY when array items are wrapped into E''
Date: 2023-11-30 12:50:03
Message-ID: 8bd8a9eece0945c79b120dca149a1165@cft.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi, Baurzhan!

I've checked the requests and here's what I think about it.
There is no mistake here.

Here's how I tested

1. select 'TextToMatch' like E'Te\%tch' returns true.
2. select 'TextToMatch' like E'nomatch' returns false.
3. select 'TextToMatch' not like E'Te\%tch' returns false.
4. select 'TextToMatch' not like E'nomatch' returns true.

LIKE ANY 1, 2 equals true.
LIKE NOT ANY 3, 4 equals true.

Maybe you need to use NOT ALL?

>The following bug has been logged on the website:

>Bug reference: 18218
>Logged by: Baurzhan Sakhariyev
>Email address: baurzhansahariev(at)gmail(dot)com
>PostgreSQL version: 15.0
>Operating system: MacOS
>Description:

>https://www.db-fiddle.com/f/cpNjWRLmQT6UFb2wEo2LoG/0

>select 'TextToMatch' like any (array[E'Te\%tch', E'nomatch']); -- true, correct select 'TextToMatch' NOT like any (array[E'Te\%>tch', E'nomatch']); -- true but must be false because it's a negated version of the expression above

>Please note, that versions without E'' work as expected.
>select 'TextToMatch' like any (array['Te\%tch', 'nomatch']); -- false select 'TextToMatch' NOT like any (array['Te\%tch', >'nomatch']); -- true

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-11-30 13:06:22 Re: BUG #18218: NOT LIKE ANY returns same result as LIKE ANY when array items are wrapped into E''
Previous Message PG Bug reporting form 2023-11-30 10:54:36 BUG #18218: NOT LIKE ANY returns same result as LIKE ANY when array items are wrapped into E''