Fix regexp substring matching (substring(string from pattern)) for the corner
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 19 Mar 2008 02:41:15 +0000 (02:41 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 19 Mar 2008 02:41:15 +0000 (02:41 +0000)
commitdc870ac3e2b5d321e9c56e9e0208b18445f882ef
tree719dab24ef7338662d0a2e4b3eb8a9bf9f793a83
parentbc1a6e566a86c0c152aaf0dd9878b0724b8cd89e
Fix regexp substring matching (substring(string from pattern)) for the corner
case where there is a match to the pattern overall but the user has specified
a parenthesized subexpression and that subexpression hasn't got a match.
An example is substring('foo' from 'foo(bar)?').  This should return NULL,
since (bar) isn't matched, but it was mistakenly returning the whole-pattern
match instead (ie, 'foo').  Per bug #4044 from Rui Martins.

This has been broken since the beginning; patch in all supported versions.
The old behavior was sufficiently inconsistent that it's impossible to believe
anyone is depending on it.
src/backend/utils/adt/regexp.c