Re: [PATCH] regexp_positions ( string text, pattern text, flags text ) → setof int4range[]

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andreas Karlsson <andreas(at)proxel(dot)se>, David Fetter <david(at)fetter(dot)org>
Subject: Re: [PATCH] regexp_positions ( string text, pattern text, flags text ) → setof int4range[]
Date: 2021-03-08 18:32:43
Message-ID: F805E2C9-981F-4DE6-B583-D833D7078325@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Mar 8, 2021, at 9:20 AM, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>
> On Mon, Mar 8, 2021, at 18:11, Mark Dilger wrote:
>> > On Mar 8, 2021, at 9:05 AM, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>> >
>> > If a N+1 dimension array could easily be unnested to a N dimension array,
>> > I would prefer Tom's idea of a 2-D regexp_positions(), since it simple and not controversial.
>>
>> How about proposing some array functions to go along with the regexp_positions, and then do it that way?
>
> Sounds like a nice solution. That would be a huge win when dealing with multidimensional arrays in general.
>
> Do we have strong support on the list for such a function? If so, I can make an attempt implementing it, unless some more experienced hacker wants to do it.

That's a hard question to answer in advance. Typically, you need to propose a solution, and then get feedback. You wouldn't need to post a patch, but perhaps some examples of how you would expect it to work, like

+SELECT slice('{{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}'::integer[][], '[2,4)'::int4range);
+ slice
+-----------
+ {{2,3}}
+ {{6,7}}
+ {{10,11}}
+ {{14,15}}
+(4 rows)
+
+SELECT slice('{{{1,2,3},{4,5,6},{7,8,9}},{{10,11,12},{13,14,15},{16,17,18}}}'::integer[][][], '[2,4)'::int4range);
+ slice
+---------------------------
+ {{{4,5,6},{7,8,9}}}
+ {{{13,14,15},{16,17,18}}}
+(2 rows)
+

and then people can tell you why they hate that choice of interface.


Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bossart, Nathan 2021-03-08 18:38:55 Re: partial heap only tuples
Previous Message Chapman Flack 2021-03-08 18:30:59 Re: [PATCH] regexp_positions ( string text, pattern text, flags text ) → setof int4range[]