> On Aug 7, 2021, at 6:03 PM, Tom Lane <t...@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





Reply via email to