Re: Latest patches break one of our unit-test, related to RLS
Laurenz Albe <laurenz.albe@cybertec.at>
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Tom Lane <tgl@sss.pgh.pa.us>, Dominique Devienne <ddevienne@gmail.com>
Cc: pgsql-general@postgresql.org
Date: 2025-09-12T23:34:08Z
Lists: pgsql-general
Attachments
- v1-0001-Amend-recent-fix-for-SIMILAR-TO-regex-conversion.patch (text/x-patch) patch v1-0001
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
Commits
-
Amend recent fix for SIMILAR TO regex conversion.
- f75ff1b141a5 14.20 landed
- e09adb5b9fc9 17.7 landed
- cdf7feb96562 19 (unreleased) landed
- 9fd531534b64 15.15 landed
- 802308693f2f 18.0 landed
- 308773617d2d 13.23 landed
- 281ad4ed11d2 16.11 landed
-
Fix conversion of SIMILAR TO regexes for character classes
- e3ffc3e91d04 17.6 cited