Handle interaction of regexp's makesearch and MATCHALL more honestly.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 Aug 2021 16:18:58 +0000 (12:18 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 Aug 2021 16:18:58 +0000 (12:18 -0400)
commit8f72becd6b9484fbb429651d8859faa36532a35a
tree77d7101b1a8f7300fb51ee5b5a81d332472cb566
parentd782d5987e1022ba70171bcf3507cd87564ef23c
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.
src/backend/regex/regc_nfa.c
src/backend/regex/regcomp.c
src/backend/regex/rege_dfa.c