pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone
Date: Fri, 27 Aug 2021 16:19:07 +0000
Message-ID: <E1mJeZP-0004r9-6p@gemulon.postgresql.org> (raw)

Handle interaction of regexp's makesearch and MATCHALL more honestly.

Second thoughts about commit 824bf7190: we apply makesearch() to
an NFA after having determined whether it is a MATCHALL pattern.
Prepending ".*" doesn't make it non-MATCHALL, but it does change the
maximum possible match length, and makesearch() failed to update that.
This has no ill effects given the stylized usage of search NFAs, but
it seems like it's better to keep the data structure consistent.  In
particular, fixing this allows more honest handling of the MATCHALL
check in matchuntil(): we can now assert that maxmatchall is infinity,
instead of lamely assuming that it should act that way.

In passing, improve the code in dump[c]nfa so that infinite maxmatchall
is printed as "inf" not a magic number.

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3068e45799327298a3f4c22b03db2aa48e2ab0da

Modified Files
--------------
src/backend/regex/regc_nfa.c | 18 ++++++++++++++----
src/backend/regex/regcomp.c  |  7 +++++++
src/backend/regex/rege_dfa.c |  8 ++------
3 files changed, 23 insertions(+), 10 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1mJeZP-0004r9-6p@gemulon.postgresql.org>
Permalink:  ../E1mJeZP-0004r9-6p@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mJeZP-0004r9-6p@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone
  In-Reply-To: <E1mJeZP-0004r9-6p@gemulon.postgresql.org>
  References: <E1mJeZP-0004r9-6p@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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