Re: Assert triggered during RE_compile_and_cache

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assert triggered during RE_compile_and_cache
Date: 2021-08-08 17:15:28
Message-ID: AB203EEC-6EB0-49BC-9585-736C40104895@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Aug 7, 2021, at 6:03 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-08-08 17:28:55 Re: Assert triggered during RE_compile_and_cache
Previous Message Tom Lane 2021-08-08 17:04:38 Re: Another regexp performance improvement: skip useless paren-captures