Re: Latest patches break one of our unit-test, related to RLS - Mailing list pgsql-general

From Laurenz Albe
Subject Re: Latest patches break one of our unit-test, related to RLS
Date
Msg-id 2c58dcdba889f5b28df5ad9d21b5ea2d0ac63a9a.camel@cybertec.at
Whole thread Raw
In response to Re: Latest patches break one of our unit-test, related to RLS  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Latest patches break one of our unit-test, related to RLS
List pgsql-general
On Fri, 2025-09-12 at 10:07 -0400, Tom Lane wrote:
> Dominique Devienne <ddevienne@gmail.com> writes:
> > > This DOES look like a bug, no? I've done regexes for a long time,
> > > and these two forms should be equivalent IMHO. --DD
>
> Yeah, I agree it's busted.  You can use EXPLAIN VERBOSE to see the
> translated-to-POSIX pattern, and it's wrong:
>
> regression=# explain verbose with t(v) as (values ('foo:bar'), ('foo/bar'),
('foo0bar'))                                         
> select v from t where v similar to 'foo[\d\w]_%';
>                           QUERY PLAN                         
> --------------------------------------------------------------
>  Values Scan on "*VALUES*"  (cost=0.00..0.05 rows=1 width=32)
>    Output: "*VALUES*".column1
>    Filter: ("*VALUES*".column1 ~ '^(?:foo[\d\w]_%)$'::text)
> (3 rows)
>
> The _ and % are not getting converted to their POSIX equivalents
> ("." and ".*").

Indeed, and I have to take the blame for introducing a bug in a minor
release :^(

The attached patch should fix the problem.

Yours,
Laurenz Albe

Attachment

pgsql-general by date:

Previous
From: Ellen Allhatatlan
Date:
Subject: Re: MVCC and all that...
Next
From: Tom Lane
Date:
Subject: Re: Latest patches break one of our unit-test, related to RLS