> On Mar 8, 2021, at 9:20 AM, Joel Jacobson <j...@compiler.org> wrote:
>
> On Mon, Mar 8, 2021, at 18:11, Mark Dilger wrote:
>> > On Mar 8, 2021, at 9:05 AM, Joel Jacobson <j...@compiler.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