Re: Another regexp performance improvement: skip useless paren-captures - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: Another regexp performance improvement: skip useless paren-captures
Date
Msg-id 1303A200-4615-4559-961A-CC906DE07EAF@enterprisedb.com
Whole thread Raw
In response to Re: Another regexp performance improvement: skip useless paren-captures  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Another regexp performance improvement: skip useless paren-captures
List pgsql-hackers

> On Aug 9, 2021, at 4:31 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> This patch should work OK in HEAD and v14, but it will need
> a bit of fooling-about for older branches I think, given that
> they fill v->subs[] a little differently.

Note that I tested your patch *before* master, so the changes look backwards.

I tested this fix and it seems good to me.  Some patterns that used to work (by chance?) now raise an error, such as:

 select 'bpgouiwcquu' ~ '(((([e])*?)){0,0}?(\3))';
-ERROR:  invalid regular expression: invalid backreference number
+ ?column?
+----------
+ f
+(1 row)

I ran a lot of tests with the patch, and the asserts have all cleared up, but I don't know how to think about the user
facingdifferences.  If we had a good reason for raising an error for these back-references, maybe that'd be fine, but
itseems to just be an implementation detail. 

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: Another regexp performance improvement: skip useless paren-captures
Next
From: Peter Smith
Date:
Subject: Re: Small documentation improvement for ALTER SUBSCRIPTION