Re: Patch: regexp_matches variant returning an array of matching positions

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: regexp_matches variant returning an array of matching positions
Date: 2014-01-29 07:09:00
Message-ID: 1390979340422-5789434.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Erik Rijkers wrote
> On Wed, January 29, 2014 05:16, David Johnston wrote:
>>
>> How does this resolve in the patch?
>>
>> SELECT regexp_matches('abcabc','((a)(b)(c))','g');
>>
>
> With the patch:
>
> testdb=# SELECT regexp_matches('abcabc','((a)(b)(c))','g'),
> regexp_matches_positions('abcabc','((a)(b)(c))');
> regexp_matches | regexp_matches_positions
> ----------------+--------------------------
> {abc,a,b,c} | {1,1,2,3}
> {abc,a,b,c} | {1,1,2,3}
> (2 rows)

The {1,1,2,3} in the second row is an artifact/copy from
set-value-function-in-select-list repetition and has nothing to do with the
second match.

> testdb=# SELECT regexp_matches('abcabc','((a)(b)(c))','g'),
> regexp_matches_positions('abcabc','((a)(b)(c))', 'g');
> regexp_matches | regexp_matches_positions
> ----------------+--------------------------
> {abc,a,b,c} | {1,1,2,3}
> {abc,a,b,c} | {4,4,5,6}
> (2 rows)

As expected.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Patch-regexp-matches-variant-returning-an-array-of-matching-positions-tp5789321p5789434.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kouhei Kaigai 2014-01-29 07:34:55 Re: WIP patch (v2) for updatable security barrier views
Previous Message Erik Rijkers 2014-01-29 06:55:45 Re: Re: Patch: regexp_matches variant returning an array of matching positions