pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone 2+ messages / 1 participants [nested] [flat]
* pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone @ 2021-08-27 16:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2021-08-27 16:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone @ 2021-08-27 16:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2021-08-27 16:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/8f72becd6b9484fbb429651d8859faa36532a35a 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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-08-27 16:19 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-08-27 16:19 pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone Tom Lane <tgl@sss.pgh.pa.us> 2021-08-27 16:19 pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone Tom Lane <tgl@sss.pgh.pa.us>
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