Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WH1E4-0003ga-Kr for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Feb 2014 01:17:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WH1E3-0007Yd-Rz for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Feb 2014 01:17:55 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WH1E2-0007YU-5w for pgsql-hackers@postgresql.org; Sat, 22 Feb 2014 01:17:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WH1Dz-0008SP-LT for pgsql-hackers@postgresql.org; Sat, 22 Feb 2014 01:17:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s1M1HaWr000647; Fri, 21 Feb 2014 20:17:36 -0500 From: Tom Lane To: Craig Ringer , Florian Pflug , Pg Hackers , Sandro Santilli Subject: Re: Uninterruptable regexp_replace in 9.3.1 ? In-reply-to: <3663.1393002213@sss.pgh.pa.us> References: <20140221091759.GK6924@localhost> <530774E5.5040105@2ndquadrant.com> <53077EED.2000907@2ndquadrant.com> <3663.1393002213@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 21 Feb 2014 12:03:33 -0500" Date: Fri, 21 Feb 2014 20:17:36 -0500 Message-ID: <646.1393031856@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org I wrote: > Craig Ringer 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