pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix regexport.c to behave sanely with lookaround constraints. 5+ messages / 1 participants [nested] [flat]
* pgsql: Fix regexport.c to behave sanely with lookaround constraints. @ 2017-04-13 21:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2017-04-13 21:18 UTC (permalink / raw) To: pgsql-committers Fix regexport.c to behave sanely with lookaround constraints. regexport.c thought it could just ignore LACON arcs, but the correct behavior is to treat them as satisfiable while consuming zero input (rather reminiscently of commit 9f1e642d5). Otherwise, the emitted simplified-NFA representation may contain no paths leading from initial to final state, which unsurprisingly confuses pg_trgm, as seen in bug #14623 from Jeff Janes. Since regexport's output representation has no concept of an arc that consumes zero input, recurse internally to find the next normal arc(s) after any LACON transitions. We'd be forced into changing that representation if a LACON could be the last arc reaching the final state, but fortunately the regex library never builds NFAs with such a configuration, so there always is a next normal arc. Back-patch to 9.3 where this logic was introduced. Discussion: https://postgr.es/m/20170413180503.25948.94871@wrigleys.postgresql.org Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/6cfaffc0ddc73dab6857c094f98b28761898cc6d Modified Files -------------- contrib/pg_trgm/expected/pg_trgm.out | 12 +++++ contrib/pg_trgm/sql/pg_trgm.sql | 3 ++ src/backend/regex/regexport.c | 90 ++++++++++++++++++++++++++---------- 3 files changed, 80 insertions(+), 25 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix regexport.c to behave sanely with lookaround constraints. @ 2017-04-13 21:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2017-04-13 21:18 UTC (permalink / raw) To: pgsql-committers Fix regexport.c to behave sanely with lookaround constraints. regexport.c thought it could just ignore LACON arcs, but the correct behavior is to treat them as satisfiable while consuming zero input (rather reminiscently of commit 9f1e642d5). Otherwise, the emitted simplified-NFA representation may contain no paths leading from initial to final state, which unsurprisingly confuses pg_trgm, as seen in bug #14623 from Jeff Janes. Since regexport's output representation has no concept of an arc that consumes zero input, recurse internally to find the next normal arc(s) after any LACON transitions. We'd be forced into changing that representation if a LACON could be the last arc reaching the final state, but fortunately the regex library never builds NFAs with such a configuration, so there always is a next normal arc. Back-patch to 9.3 where this logic was introduced. Discussion: https://postgr.es/m/20170413180503.25948.94871@wrigleys.postgresql.org Branch ------ REL9_6_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a70b18b89459c137d7c2554133981b0752450e4e Modified Files -------------- contrib/pg_trgm/expected/pg_trgm.out | 12 +++++ contrib/pg_trgm/sql/pg_trgm.sql | 3 ++ src/backend/regex/regexport.c | 92 ++++++++++++++++++++++++++---------- 3 files changed, 82 insertions(+), 25 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix regexport.c to behave sanely with lookaround constraints. @ 2017-04-13 21:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2017-04-13 21:18 UTC (permalink / raw) To: pgsql-committers Fix regexport.c to behave sanely with lookaround constraints. regexport.c thought it could just ignore LACON arcs, but the correct behavior is to treat them as satisfiable while consuming zero input (rather reminiscently of commit 9f1e642d5). Otherwise, the emitted simplified-NFA representation may contain no paths leading from initial to final state, which unsurprisingly confuses pg_trgm, as seen in bug #14623 from Jeff Janes. Since regexport's output representation has no concept of an arc that consumes zero input, recurse internally to find the next normal arc(s) after any LACON transitions. We'd be forced into changing that representation if a LACON could be the last arc reaching the final state, but fortunately the regex library never builds NFAs with such a configuration, so there always is a next normal arc. Back-patch to 9.3 where this logic was introduced. Discussion: https://postgr.es/m/20170413180503.25948.94871@wrigleys.postgresql.org Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/67665a71c003d0bc4d261f134cbc0989effc6927 Modified Files -------------- contrib/pg_trgm/expected/pg_trgm.out | 12 +++++ contrib/pg_trgm/sql/pg_trgm.sql | 3 ++ src/backend/regex/regexport.c | 92 ++++++++++++++++++++++++++---------- 3 files changed, 82 insertions(+), 25 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix regexport.c to behave sanely with lookaround constraints. @ 2017-04-13 21:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2017-04-13 21:18 UTC (permalink / raw) To: pgsql-committers Fix regexport.c to behave sanely with lookaround constraints. regexport.c thought it could just ignore LACON arcs, but the correct behavior is to treat them as satisfiable while consuming zero input (rather reminiscently of commit 9f1e642d5). Otherwise, the emitted simplified-NFA representation may contain no paths leading from initial to final state, which unsurprisingly confuses pg_trgm, as seen in bug #14623 from Jeff Janes. Since regexport's output representation has no concept of an arc that consumes zero input, recurse internally to find the next normal arc(s) after any LACON transitions. We'd be forced into changing that representation if a LACON could be the last arc reaching the final state, but fortunately the regex library never builds NFAs with such a configuration, so there always is a next normal arc. Back-patch to 9.3 where this logic was introduced. Discussion: https://postgr.es/m/20170413180503.25948.94871@wrigleys.postgresql.org Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/b179684c77bb16640cdea6fd3d7a1e333829334e Modified Files -------------- contrib/pg_trgm/expected/pg_trgm.out | 12 +++++ contrib/pg_trgm/sql/pg_trgm.sql | 3 ++ src/backend/regex/regexport.c | 92 ++++++++++++++++++++++++++---------- 3 files changed, 82 insertions(+), 25 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix regexport.c to behave sanely with lookaround constraints. @ 2017-04-13 21:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2017-04-13 21:18 UTC (permalink / raw) To: pgsql-committers Fix regexport.c to behave sanely with lookaround constraints. regexport.c thought it could just ignore LACON arcs, but the correct behavior is to treat them as satisfiable while consuming zero input (rather reminiscently of commit 9f1e642d5). Otherwise, the emitted simplified-NFA representation may contain no paths leading from initial to final state, which unsurprisingly confuses pg_trgm, as seen in bug #14623 from Jeff Janes. Since regexport's output representation has no concept of an arc that consumes zero input, recurse internally to find the next normal arc(s) after any LACON transitions. We'd be forced into changing that representation if a LACON could be the last arc reaching the final state, but fortunately the regex library never builds NFAs with such a configuration, so there always is a next normal arc. Back-patch to 9.3 where this logic was introduced. Discussion: https://postgr.es/m/20170413180503.25948.94871@wrigleys.postgresql.org Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/5be58cc89acef45fff14159fdfefbacfac08bfde Modified Files -------------- contrib/pg_trgm/expected/pg_trgm.out | 12 +++++ contrib/pg_trgm/sql/pg_trgm.sql | 3 ++ src/backend/regex/regexport.c | 92 ++++++++++++++++++++++++++---------- 3 files changed, 82 insertions(+), 25 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2017-04-13 21:18 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-04-13 21:18 pgsql: Fix regexport.c to behave sanely with lookaround constraints. Tom Lane <tgl@sss.pgh.pa.us> 2017-04-13 21:18 pgsql: Fix regexport.c to behave sanely with lookaround constraints. Tom Lane <tgl@sss.pgh.pa.us> 2017-04-13 21:18 pgsql: Fix regexport.c to behave sanely with lookaround constraints. Tom Lane <tgl@sss.pgh.pa.us> 2017-04-13 21:18 pgsql: Fix regexport.c to behave sanely with lookaround constraints. Tom Lane <tgl@sss.pgh.pa.us> 2017-04-13 21:18 pgsql: Fix regexport.c to behave sanely with lookaround constraints. 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