Search Postgresql Archives

Re: display array field as row

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

create or replace function unnest(anyarray)
returns setof anyelement as $$
select $1[i] from generate_series(array_lower($1,1),array_upper($1,1)) g(i);
$$ language sql immutable;

select conname, contype, unnest(conkey) from ...

regards
Pavel Stehule

2009/2/3 hendra kusuma <penguinroad@xxxxxxxxx>:
> Dear all,
>
> Does anyone know how to display an array data into row?
> for exampla, I have data like this
>
> conname contype conkey
>
>
> kelas_pkey p {1,2}
>
>
> kelas_tahun f {2}
>
>
>
> And I want to to display those data above like below
>
> kelas_pkey     p     1
> kelas_pkey     p     2
> kelas_tahun   f      2
>
> Do you know any sql syntax that would do?
> I cannot find it in documentation
> or is it not possible?
>
> Regards
> Hendra
>

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux