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

From: Bauyrzhan Sakhariyev <baurzhansahariev(at)gmail(dot)com>
To: 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 13:20:21
Message-ID: CAKpL73tpx-+ep1Vt5jaGA5bb28DQwxoLoyn9zLRGpB1cZXgCAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Oh, you right, sorry for the noise and thanks for the clarification!

On Thu, Nov 30, 2023 at 2:06 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > 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
>
> No, it is not. "NOT LIKE" is the operator to apply in this context,
> so the second expression returns true if the test string is NOT LIKE
> either of the array elements. You could write
>
> NOT ('TextToMatch' like any (array[E'Te\%tch', E'nomatch']))
>
> to get the behavior you are after. Or write NOT LIKE ALL,
> as Orlov suggests.
>
> regards, tom lane
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Şeyma Alkan 2023-11-30 13:36:25 Re: BUG #18198: Constantly getting errors
Previous 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''