Search Postgresql Archives

Re: HOWTO: select * from array_type

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

 



Hello

you need SQL function upack

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

postgres=# select * from unpack('{one, two, three}'::text[]);
 unpack
--------
 one
 two
 three
(3 rows)

regards
Pavel Stehule

2008/9/11 alefajnie <devphyl@xxxxxxxxx>:
> hey
>
> I have : (A)
> select (string_to_array(mycolumn, ' ')) from mytable  where id = sth;
>
> and here receive:
> {'one', 'two', 'three'}
> 1 row
>
> but I want 3 rows with data:
> 'one'
> 'two'
> 'three'
>
>
> how make second select of above (A) ?
>
> btw: is any subtrace on psql arrays ?
>
> --
> 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