From: Tom Lane <tgl@sss.pgh.pa.us>
To: Craig Ringer <craig@2ndquadrant.com>
To: Florian Pflug <fgp@phlo.org>
To: Pg Hackers <pgsql-hackers@postgresql.org>
To: Sandro Santilli <strk@keybit.net>
Subject: Re: Uninterruptable regexp_replace in 9.3.1 ?
Date: Fri, 21 Feb 2014 20:17:36 -0500
Message-ID: <646.1393031856@sss.pgh.pa.us> (raw)
In-Reply-To: <3663.1393002213@sss.pgh.pa.us>
References: <20140221091759.GK6924@localhost>
<530774E5.5040105@2ndquadrant.com>
<D4594E29-6A28-43C0-BD33-FC3EE8A23683@phlo.org>
<53077EED.2000907@2ndquadrant.com>
<3663.1393002213@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
I wrote:
> Craig Ringer <craig@2ndquadrant.com> writes:
>> So I'd like to confirm that this issue doesn't affect 9.1.
> It doesn't. I suspect it has something to do with 173e29aa5 or one
> of the nearby commits in backend/regex/.
Indeed, git bisect fingers that commit as introducing the problem.
What seems to be happening is that citerdissect() is trying some
combinatorially large number of ways to split the input string into
substrings that can satisfy the argument of the outer "+" iterator.
It keeps failing on the substring starting with the first '$', and
then vainly looking for other splits that dodge the problem.
I'm not entirely sure how come the previous coding didn't fall into
the same problem. It's quite possible Henry Spencer is smarter than
I am, but there was certainly nothing there before that was obviously
avoiding this hazard.
Worthy of note is that I think pre-9.2 is actually giving the wrong
answer --- it's claiming the whole string matches the regex,
which it does not if I'm reading it right. This may be related to
the problem that commit 173e29aa5 was trying to fix, ie failure to
enforce backref matches in some cases. So one possible theory is
that by failing to notice that it *didn't* have a valid match,
the old code accidentally failed to go down the rabbit hole of trying
zillions of other ways to match.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, craig@2ndquadrant.com, fgp@phlo.org, pgsql-hackers@postgresql.org, strk@keybit.net
Subject: Re: Uninterruptable regexp_replace in 9.3.1 ?
In-Reply-To: <646.1393031856@sss.pgh.pa.us>
References: <20140221091759.GK6924@localhost> <530774E5.5040105@2ndquadrant.com> <D4594E29-6A28-43C0-BD33-FC3EE8A23683@phlo.org> <53077EED.2000907@2ndquadrant.com> <3663.1393002213@sss.pgh.pa.us> <646.1393031856@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox