Обсуждение: generate_subscripts

Поиск
Список
Период
Сортировка

generate_subscripts

От
"Pavel Stehule"
Дата:
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

Вложения

Re: generate_subscripts

От
Alvaro Herrera
Дата:
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.