]> granicus.if.org Git - postgresql/commit
Fix similar_escape() so that SIMILAR TO works properly for patterns involving
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 13 Apr 2006 18:01:53 +0000 (18:01 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 13 Apr 2006 18:01:53 +0000 (18:01 +0000)
commite1b40c521ee497836a28ef80e599668b8619d003
tree91482db791d816bb48949614c8415f952f67c9fc
parente314c3f53f2ff8e58f459fb3211ae87fce460be7
Fix similar_escape() so that SIMILAR TO works properly for patterns involving
alternatives ("|" symbol).  The original coding allowed the added ^ and $
constraints to be absorbed into the first and last alternatives, producing
a pattern that would match more than it should.  Per report from Eric Noriega.

I also changed the pattern to add an ARE director ("***:"), ensuring that
SIMILAR TO patterns do not change behavior if regex_flavor is changed.  This
is necessary to make the non-capturing parentheses work, and seems like a
good idea on general principles.

Back-patched as far as 7.4.  7.3 also has the bug, but a fix seems impractical
because that version's regex engine doesn't have non-capturing parens.
src/backend/utils/adt/regexp.c