Skip site navigation (1) Skip section navigation (2)

pgsql: Fix the general case of quantified regex back-references.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix the general case of quantified regex back-references.
Date: 2012-02-24 06:41:24
Message-ID: E1S0oqK-0006Nh-82@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Fix the general case of quantified regex back-references.

Cases where a back-reference is part of a larger subexpression that
is quantified have never worked in Spencer's regex engine, because
he used a compile-time transformation that neglected the need to
check the back-reference match in iterations before the last one.
(That was okay for capturing parens, and we still do it if the
regex has *only* capturing parens ... but it's not okay for backrefs.)

To make this work properly, we have to add an "iteration" node type
to the regex engine's vocabulary of sub-regex nodes.  Since this is a
moderately large change with a fair risk of introducing new bugs of its
own, apply to HEAD only, even though it's a fix for a longstanding bug.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/173e29aa5deefd9e71c183583ba37805c8102a72

Modified Files
--------------
src/backend/regex/README            |   18 +-
src/backend/regex/regcomp.c         |   88 +++--
src/backend/regex/regexec.c         |  764 ++++++++++++++++++++++++++++++++++-
src/include/regex/regguts.h         |   24 +-
src/test/regress/expected/regex.out |   37 ++
src/test/regress/sql/regex.sql      |    8 +
6 files changed, 884 insertions(+), 55 deletions(-)

pgsql-committers by date

Next:From: Peter EisentrautDate: 2012-02-24 09:05:45
Subject: pgsql: Add some enumeration commas, for consistency
Previous:From: Andrew DunstanDate: 2012-02-24 04:45:20
Subject: pgsql: Correctly handle NULLs in JSON output.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group