Repair bug in regexp split performance improvements.
authorAndrew Gierth <rhodiumtoad@postgresql.org>
Wed, 12 Sep 2018 18:31:06 +0000 (19:31 +0100)
committerAndrew Gierth <rhodiumtoad@postgresql.org>
Wed, 12 Sep 2018 18:43:44 +0000 (19:43 +0100)
commitf7d0343ead29cd3e44eccd1c8b7cc291b79209fe
tree6342f1d05a6715ea1ee5855e389fd09b21abbfe2
parentb91ae36029df3db31a951ebda102ace8be5741ba
Repair bug in regexp split performance improvements.

Commit c8ea87e4b introduced a temporary conversion buffer for
substrings extracted during regexp splits. Unfortunately the code that
sized it was failing to ignore the effects of ignored degenerate
regexp matches, so for regexp_split_* calls it could under-size the
buffer in such cases.

Fix, and add some regression test cases (though those will only catch
the bug if run in a multibyte encoding).

Backpatch to 9.3 as the faulty code was.

Thanks to the PostGIS project, Regina Obe and Paul Ramsey for the
report (via IRC) and assistance in analysis. Patch by me.
src/backend/utils/adt/regexp.c
src/test/regress/expected/strings.out
src/test/regress/sql/strings.sql