From: | "Marcin Krawczyk" <jankes(dot)mk(at)gmail(dot)com> |
---|---|
To: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: aggregate reverse |
Date: | 2008-02-02 08:48:27 |
Message-ID: | 95f6bf9b0802020048r336ba75etb2cf7508d0098854@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Yes, you got me well. That's exactly what I was trying to achieve. Thank
you.
2008/2/1, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>
> Hello
>
> I am not sure if I understand well.
>
> On 01/02/2008, Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com> wrote:
> > Hi all. I wolud like to know whether it is possible to reverse the
> behaviour
> > of an aggregate? Say I have a string '1,2,3,4'. Is there a way to split
> > those values to records?
>
> create or replace function unpack(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 * from unpack(string_to_array('1,2,3,4',','));
> unpack
> --------
> 1
> 2
> 3
> 4
> (4 rows)
>
> Regards
> Pavel
>
>
> >
> > Regards and thanks in advance.
> > mk
> >
>
From | Date | Subject | |
---|---|---|---|
Next Message | chrisj | 2008-02-02 23:22:10 | can a insert with a returning clause be subquery ? |
Previous Message | Pavel Stehule | 2008-02-01 17:33:54 | Re: aggregate reverse |