]> granicus.if.org Git - postgresql/commit
Fix regexp_matches() handling of zero-length matches.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 31 Jul 2013 15:31:30 +0000 (11:31 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 31 Jul 2013 15:31:30 +0000 (11:31 -0400)
commit8505ebf31eb50c20afeaca0e0dfa2fbb1cec001f
treed9e53acf94ee2c0ff11ffcc2e689a935bd2a04f7
parente73357c10b8ca7f38e83e73e57f09d774a83db2f
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.
src/backend/utils/adt/regexp.c
src/backend/utils/adt/varlena.c
src/test/regress/expected/strings.out
src/test/regress/sql/strings.sql