public inbox for [email protected]  
help / color / mirror / Atom feed
Re: Latest patches break one of our unit-test, related to RLS
2+ messages / 1 participants
[nested] [flat]

* Re: Latest patches break one of our unit-test, related to RLS
@ 2025-09-12 13:24 Dominique Devienne <[email protected]>
  2025-09-12 13:29 ` Re: Latest patches break one of our unit-test, related to RLS Dominique Devienne <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Dominique Devienne @ 2025-09-12 13:24 UTC (permalink / raw)
  To: Laurenz Albe <[email protected]>; +Cc: pgsql-general

On Fri, Sep 12, 2025 at 3:11 PM Dominique Devienne <[email protected]> wrote:
> On Fri, Sep 12, 2025 at 2:45 PM Laurenz Albe <[email protected]> wrote:
> > You don't show us that data that match the pattern in 17.5, but
> > not in 17.6.  Unless you show us a counterexample, I'd say that
> > the behavior in 17.6 is correct.

I've reread https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP
and especially:

> According to the SQL standard, omitting ESCAPE means there is no escape character (rather than defaulting to a backslash), and a zero-length ESCAPE value is disallowed. PostgreSQL's behavior in this regard is therefore slightly nonstandard.

and also

> Another nonstandard extension is that following the escape character with a letter or digit provides access to the escape sequences defined for POSIX regular expressions; see Table 9.20, Table 9.21, and Table 9.22 below.

Table 9.21. Regular Expression Class-Shorthand Escapes
\d matches any digit, like [[:digit:]]
\w matches any word character, like [[:word:]]

So I don't see how my `... where v similar to 'foo[\d\w]_%'` is incorrect.

So again, is this a bug / regression or not? Thanks, --DD






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Latest patches break one of our unit-test, related to RLS
  2025-09-12 13:24 Re: Latest patches break one of our unit-test, related to RLS Dominique Devienne <[email protected]>
@ 2025-09-12 13:29 ` Dominique Devienne <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dominique Devienne @ 2025-09-12 13:29 UTC (permalink / raw)
  To: Laurenz Albe <[email protected]>; +Cc: pgsql-general

On Fri, Sep 12, 2025 at 3:24 PM Dominique Devienne <[email protected]> wrote:
> On Fri, Sep 12, 2025 at 3:11 PM Dominique Devienne <[email protected]> wrote:

> So I don't see how my `... where v similar to 'foo[\d\w]_%'` is incorrect.
> So again, is this a bug / regression or not? Thanks, --DD

If I use (x|y) instead of [xy] it seems to behave correctly.
Whether x is the full-length POSIX class, or the shorthand notation.
This DOES look like a bug, no? I've done regexes for a long time,
and these two forms should be equivalent IMHO. --DD

postgres=# show server_version;
 server_version
----------------
 18rc1
(1 row)


postgres=# with t(v) as (values ('foo:bar'), ('foo/bar'), ('foo0bar'))
select v from t where v similar to 'foo[\d\w]_%';
 v
---
(0 rows)


postgres=# with t(v) as (values ('foo:bar'), ('foo/bar'), ('foo0bar'))
select v from t where v similar to 'foo[[[:digit:]][[:word:]]]_%';
 v
---
(0 rows)


postgres=# with t(v) as (values ('foo:bar'), ('foo/bar'), ('foo0bar'))
select v from t where v similar to 'foo([[:digit:]]|[[:word:]])_%';
    v
---------
 foo0bar
(1 row)


postgres=# with t(v) as (values ('foo:bar'), ('foo/bar'), ('foo0bar'))
select v from t where v similar to 'foo(\d|\w)_%';
    v
---------
 foo0bar
(1 row)






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-09-12 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-09-12 13:24 Re: Latest patches break one of our unit-test, related to RLS Dominique Devienne <[email protected]>
2025-09-12 13:29 ` Dominique Devienne <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox