Re: Death by regexp_replace - Mailing list pgsql-hackers

From Benedikt Grundmann
Subject Re: Death by regexp_replace
Date
Msg-id CADbMkNNxTCmCwwR9NHYrUbV_11N5_=APr6wj+qxPE22nunLh3Q@mail.gmail.com
Whole thread Raw
In response to Re: Death by regexp_replace  (Kevin Grittner <kgrittn@gmail.com>)
List pgsql-hackers
<div dir="ltr">9.2.6</div><div class="gmail_extra"><br /><div class="gmail_quote">On Fri, Jan 15, 2016 at 3:48 PM,
KevinGrittner <span dir="ltr"><<a href="mailto:kgrittn@gmail.com" target="_blank">kgrittn@gmail.com</a>></span>
wrote:<br/><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
class="">OnFri, Jan 15, 2016 at 9:33 AM, Tom Lane <<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>>
wrote:<br/><br /> >> *WARNING DO NOT DO THIS ON A PRODUCTION BOX*<br /> >> select regexp_replace('VODI
GR,VODLN,VOD LN,VODN MM,VODPF US,VOD US,VZC<br /> >> LN', '([^,]+)(,*\1)+', '\1');<br /><br /></span><span
class="">>This responds to cancel just fine for me.<br /><br /></span><span class="">> (FWIW, I think you
probablywanted ,+ not ,* in the regex, else there's<br /> > practically no constraint there, leading to having to
considerO(N^2)<br /> > or more possibilities.)<br /><br /></span>On master (commit cf7dfbf2) it responds to
pg_cancel_backend(),<br/> but it seems to be in an endless loop until you do that.<br /><span class="HOEnZb"><font
color="#888888"><br/> --<br /> Kevin Grittner<br /> EDB: <a href="http://www.enterprisedb.com" rel="noreferrer"
target="_blank">http://www.enterprisedb.com</a><br/> The Enterprise PostgreSQL Company<br
/></font></span></blockquote></div><br/></div> 

pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Re: Limit and inherited tables
Next
From: Stephen Frost
Date:
Subject: Re: Multi-tenancy with RLS