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: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
Cc: "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-11 15:59:21
Message-ID: 32565.1557590361@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Daniel Verite" <daniel(at)manitou-mail(dot)org> writes:
> Robert Schreiber wrote:
>> What appears to be happening is that the _Q? on the tail_ is being
>> matched, but _the Q is also being included in the collected data.__

> You seem to expect that % must be non-greedy and let the final Q?
> match 1 Q instead of 0, but there doesn't appear to be anything
> in the doc that supports this interpretation.
> In fact, it mentions that "%" is comparable to ".*" in POSIX
> regular expressions, and the latter _is_ greedy.

Right. You could get the behavior you want using a non-greedy quantifier,
but you'd have to use the POSIX regexp functions, not substring().

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

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