Re: patch: array_ndims

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Robert Haas" <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: array_ndims
Date: 2008-10-11 06:29:25
Message-ID: 162867790810102329v5bcc42o2853985d32512eba@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

we talked about these features, but these functionality is solved with
UNNEST operator
http://farrago.sourceforge.net/design/CollectionTypes.html - so if you
like this functionality (I believe, so want it), please implement
UNNEST operator.

Regards
Pavel Stehule

http://www.ibm.com/developerworks/db2/library/techarticle/dm-0710arocena/index.html

2008/10/11 Robert Haas <robertmhaas(at)gmail(dot)com>:
> After reading Josh Berkus's email suggesting that the intagg module be
> dropped, I was wondering what would be required to create a array
> enumerator (variously called unnest, unroll, array_enum, and, as
> contemplated by the TODO list, array_to_set). Pavel Stehule's
> generate_subscripts function provides most of what is needed -
> however, you need to know the number of dimensions in the array, and
> it appears we don't have a function to provide that information, at
> least not in a straightforward fashion. That seems like a pretty
> useful thing to have anyway, so here's a patch to add it.
>
> If you apply it, you can then used the attached PL/pgsql
> implementation of array_to_set(). I am sure that it would be better
> and more efficient to implement this directly in C, but as no one has
> gotten around to that yet this might be kind of handy. It might even
> be worth adding to the docs, though I'm not sure exactly where.
>
> rhaas=# SELECT * FROM array_to_set(ARRAY[1,2,3,4]);
> array_to_set
> --------------
> 1
> 2
> 3
> 4
> (4 rows)
>
> rhaas=# SELECT * FROM array_to_set(ARRAY[[1,2,3,4]]);
> array_to_set
> --------------
> 1
> 2
> 3
> 4
> (4 rows)
>
> rhaas=# SELECT * FROM array_to_set(ARRAY[[[1,2,3,4]]]);
> array_to_set
> --------------
> 1
> 2
> 3
> 4
> (4 rows)
>
> rhaas=# SELECT * FROM array_to_set(ARRAY[[[[1,2,3,4]]]]);
> array_to_set
> --------------
> 1
> 2
> 3
> 4
> (4 rows)
>
> rhaas=# SELECT * FROM array_to_set(ARRAY[[[[[1,2,3,4]]]]]);
> array_to_set
> --------------
> 1
> 2
> 3
> 4
> (4 rows)
>
> rhaas=# SELECT * FROM array_to_set(ARRAY[[[[[[1,2,3,4]]]]]]);
> array_to_set
> --------------
> 1
> 2
> 3
> 4
> (4 rows)
>
> ...Robert
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Benedek László 2008-10-11 06:45:16 Re: pg_dump roles support
Previous Message tomas 2008-10-11 04:47:46 Re: The Axe list