Thread: generate_subscripts

generate_subscripts

From
"Pavel Stehule"
Date:
Hello

This patch contains generate_subscripts functions, that generate
series of array's subscripts of some dimension:

postgres=#
create or replace function unnest2(anyarray)
returns setof anyelement as $$
select $1[i][j]
   from generate_subscripts($1,1) g1(i),
        generate_subscripts($1,2) g2(j);
$$ language sql immutable;

postgres=# select * from unnest2(array[[1,2],[3,4]]);
 unnest2
---------
       1
       2
       3
       4
(4 rows)

Proposal: http://archives.postgresql.org/pgsql-hackers/2007-10/msg00874.php

Regards
Pavel Stehule

Attachment

Re: generate_subscripts

From
Alvaro Herrera
Date:
Pavel Stehule escribió:

> This patch contains generate_subscripts functions, that generate
> series of array's subscripts of some dimension:

Committed, thanks.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.