Uninterruptable regexp_replace in 9.3.1 ?

From: Sandro Santilli <strk(at)keybit(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Uninterruptable regexp_replace in 9.3.1 ?
Date: 2014-02-21 09:17:59
Message-ID: 20140221091759.GK6924@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following snippet reveals that 9.3.1 has a bug
in regexp_matches, which uninterruptably keeps CPU
spinning for minutes:

-----8<---------------------------------------------------

\timing
SET statement_timeout = 2;
-- this is only to show statement_timeout is effective here
SELECT count(*) from generate_series(1, 100000);
-- this one is uninterruptable!
SELECT regexp_matches($INPUT$

/a
$b$
$c$d
;
$INPUT$,
$REG$((?:[^'"$;]+|"[^"]*"|'(?:[^']*|'')*'|(\$[^$]*\$).*?\2)+)$REG$, 'g' );

-----8<---------------------------------------------------

The above has been tested to be harmless with PostgreSQL 9.1.11
in that the regexp_matches call is interrupted, but it is NOT
with PostgreSQL 9.3.1.

Is it a known bug ?

Please include my address in replies as I don't get notified
of list activity. Thanks.

--strk;

()  ASCII ribbon campaign -- Keep it simple !
/\  http://strk.keybit.net/rants/ascii_mails.txt

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sandro Santilli 2014-02-21 10:27:13 Re: Uninterruptable regexp_replace in 9.3.1 ?
Previous Message David Johnston 2014-02-21 06:58:01 Re: BUG #9301: INSERT WHERE NOT EXISTS on table with UNIQUE constraint in concurrent SERIALIZABLE transactions

Browse pgsql-hackers by date

  From Date Subject
Next Message Sandro Santilli 2014-02-21 10:27:13 Re: Uninterruptable regexp_replace in 9.3.1 ?
Previous Message Andres Freund 2014-02-21 09:06:48 Re: walsender doesn't send keepalives when writes are pending