pgsql: Fix regexp_matches() handling of zero-length matches.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix regexp_matches() handling of zero-length matches.
Date: 2013-07-31 15:32:07
Message-ID: E1V4YNj-0001Zu-BZ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix regexp_matches() handling of zero-length matches.

We'd find the same match twice if it was of zero length and not immediately
adjacent to the previous match. replace_text_regexp() got similar cases
right, so adjust this search logic to match that. Note that even though
the regexp_split_to_xxx() functions share this code, they did not display
equivalent misbehavior, because the second match would be considered
degenerate and ignored.

Jeevan Chalke, with some cosmetic changes by me.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8505ebf31eb50c20afeaca0e0dfa2fbb1cec001f

Modified Files
--------------
src/backend/utils/adt/regexp.c | 13 ++++----
src/backend/utils/adt/varlena.c | 5 ++-
src/test/regress/expected/strings.out | 58 +++++++++++++++++++++++++++++++++
src/test/regress/sql/strings.sql | 7 ++++
4 files changed, 75 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2013-07-31 15:37:23 pgsql: pg_dump/pg_dumpall: remove unnecessary SQL trailing semicolons
Previous Message Fujii Masao 2013-07-31 13:54:25 pgsql: Fix typo in comment.