Re: Death by regexp_replace

From: Benedikt Grundmann <bgrundmann(at)janestreet(dot)com>
To: Kevin Grittner <kgrittn(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Death by regexp_replace
Date: 2016-01-15 16:19:10
Message-ID: CADbMkNNxTCmCwwR9NHYrUbV_11N5_=APr6wj+qxPE22nunLh3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

9.2.6

On Fri, Jan 15, 2016 at 3:48 PM, Kevin Grittner <kgrittn(at)gmail(dot)com> wrote:

> On Fri, Jan 15, 2016 at 9:33 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> >> *WARNING DO NOT DO THIS ON A PRODUCTION BOX*
> >> select regexp_replace('VODI GR,VOD LN,VOD LN,VODN MM,VODPF US,VOD US,VZC
> >> LN', '([^,]+)(,*\1)+', '\1');
>
> > This responds to cancel just fine for me.
>
> > (FWIW, I think you probably wanted ,+ not ,* in the regex, else there's
> > practically no constraint there, leading to having to consider O(N^2)
> > or more possibilities.)
>
> On master (commit cf7dfbf2) it responds to pg_cancel_backend(),
> but it seems to be in an endless loop until you do that.
>
> --
> Kevin Grittner
> EDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2016-01-15 16:21:59 Re: Multi-tenancy with RLS
Previous Message Konstantin Knizhnik 2016-01-15 16:17:00 Re: Limit and inherited tables

Browse pgsql-www by date

  From Date Subject
Next Message Tom Lane 2016-01-15 16:26:29 Re: Death by regexp_replace
Previous Message Kevin Grittner 2016-01-15 15:48:25 Re: Death by regexp_replace