From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | alefajnie <devphyl(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: HOWTO: select * from array_type |
Date: | 2008-09-16 05:45:51 |
Message-ID: | 162867790809152245y17c1f8a0nfe9650618e39a3ab@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)gmail(dot)com>:
> 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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2008-09-16 06:38:02 | Re: about partitioning |
Previous Message | Scott Marlowe | 2008-09-16 03:59:30 | Re: Default procedural language |