"Erik Rijkers" <e...@xs4all.nl> writes:
> On Wed, September 25, 2013 09:33, Marc Mamin wrote:
>> This regexp call freezes with almost 100% CPU usage, so I guess it creates 
>> an infinite loop.
>> cic_db=# select regexp_matches ('aa bb aa ba baa x','(^((?!aa)))+','gx');

I poked into this a bit and decided that it's a variant of a problem we've
seen before.  I filed a report with the Tcl crew to see if they have any
opinion about it:
https://core.tcl.tk/tcl/tktview?name=8f245009b0
but prior experience suggests they won't be a lot of help.

> On 9.3 and 9.4devel, on linux (centos 6.4), that statement / regex returns 
> after ~2 minutes (on a modest desktop) with that
> same error, but not crashing.

Yeah, it should in principle fail eventually with a too-many-states error,
since the loop is creating more NFA states than it deletes.  But on a Mac
laptop with an assert-enabled PG build, I got tired of waiting for that
after about an hour ...

                        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 via email to