Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: "Daniel Verite" <daniel(at)manitou-mail(dot)org>, "Robert Schreiber" <bobschreiber(at)charter(dot)net>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug
Date: 2019-05-12 03:50:43
Message-ID: 27602.1557633043@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> I looked up the spec on this point. As far as I can see, we're not
> following it, but neither does the spec do what the OP wanted; in fact
> the result should have included the _leading_ Q as well as the trailing
> one.

Huh, interesting. So we should be translating the initial substring
to a non-greedy pattern. I believe Spencer's engine can handle that
by sticking (?:...){1,1}? around it.

Come to think of it, we probably need to be putting (?:...) around
the trailing substring as well. I suspect what we're doing today
produces non-spec results if "|" appears in the trailing part.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2019-05-12 04:27:48 Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug
Previous Message Andrew Gierth 2019-05-12 03:19:23 Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug