Re: Assert triggered during RE_compile_and_cache - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: Assert triggered during RE_compile_and_cache
Date
Msg-id AB203EEC-6EB0-49BC-9585-736C40104895@enterprisedb.com
Whole thread Raw
In response to Re: Assert triggered during RE_compile_and_cache  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Assert triggered during RE_compile_and_cache  (Mark Dilger <mark.dilger@enterprisedb.com>)
Re: Assert triggered during RE_compile_and_cache  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

> On Aug 7, 2021, at 6:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> That requires tweaking the API of parseqatom,
> which why I'd not done it like that to begin with --- but that's not
> a hard or complicated change, just a mite tedious.
>
> Hence, the attached patch.

Applying your <alternate-backref-corner-case-fix-1.patch> to master changes the outcome of some regular expression
queries,but I *think* it changes them for the better. 

These three look to me exactly correct after the patch, and wrong before:

 select regexp_matches('vnrungnajjjgkaaeaper', '((.))(((\1)))((?:\5..))', 'mx');
- regexp_matches
-----------------
-(0 rows)
+ regexp_matches
+-----------------
+ {j,j,j,j,j,jgk}
+(1 row)

 select regexp_match('kgkgeganlifykxhfspjtgluwluwluwdfdfbbdjvrxjvrxedndrkaxxvbtqdj', '((.))\2');
  regexp_match
 --------------
-
+ {b,b}
 (1 row)

 select regexp_split_to_array('uuuzkodphfbfbfb', '((.))(\1\2)', 'ntw');
  regexp_split_to_array
 -----------------------
- {uuuzkodphfbfbfb}
+ {"",zkodphfbfbfb}
 (1 row)

But these next two look to me correct before the patch and wrong after:

 select regexp_matches('ircecpbgyiggvtruqgxzigxzigxzisdbkuhbkuhrvl', '(((.)))(?:(\3))[^\f]');
  regexp_matches
 ----------------
-(0 rows)
+ {g,g,g,g}
+(1 row)

 select regexp_matches('fhgxnvbvjaej', '(((.)).)((\3)((.)))', 'csx');
- regexp_matches
-----------------
-(0 rows)
+  regexp_matches
+-------------------
+ {vb,v,v,vj,v,j,j}
+(1 row)

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






pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Another regexp performance improvement: skip useless paren-captures
Next
From: Mark Dilger
Date:
Subject: Re: Assert triggered during RE_compile_and_cache