Re: Latest patches break one of our unit-test, related to RLS

Dominique Devienne <ddevienne@gmail.com>

From: Dominique Devienne <ddevienne@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>, pgsql-general@postgresql.org
Date: 2025-09-12T13:57:45Z
Lists: pgsql-general
On Fri, Sep 12, 2025 at 3:54 PM jian he <jian.universality@gmail.com> wrote:
> > > select v from t where v similar to 'foo[\d\w]_%';
> > > select v from t where v similar to 'foo[[[:digit:]][[:word:]]]_%';

> The above two examples are the same, per
> (Table 9.21. Regular Expression Class-Shorthand Escapes)

Of course.

> my guess why 'foo0bar' will fail for 'foo[[[:digit:]][[:word:]]]_%';
> 1. process character 0, it does meet [[:digits]] character class.
> 2. process character b, it does not meet [[:digits]], then fails,
> it won't check again whether character b is satisfied with [[:word:]] or not.

Then you don't know what [...] means in regexes I'm afraid. --DD



Commits

  1. Amend recent fix for SIMILAR TO regex conversion.

  2. Fix conversion of SIMILAR TO regexes for character classes