pgsql: Fix regexp substring matching (substring(string from pattern))

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix regexp substring matching (substring(string from pattern))
Date: 2008-03-19 02:40:37
Message-ID: 20080319024037.5345A7558DC@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/utils/adt:
regexp.c (r1.78 -> r1.79)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/regexp.c?r1=1.78&r2=1.79)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-03-19 02:40:43 pgsql: Fix regexp substring matching (substring(string from pattern))
Previous Message Tom Lane 2008-03-19 01:28:50 Re: [COMMITTERS] pgsql: Enable probes to work with Mac OS X Leopard and other OSes that