pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marcin Krawczyk <jankes.mk@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: aggregate reverse
Date: Sat, 2 Feb 2008 09:48:27 +0100
Message-ID: <95f6bf9b0802020048r336ba75etb2cf7508d0098854@mail.gmail.com> (raw)
In-Reply-To: <162867790802010933m4f3e2808w405590b26d31d402@mail.gmail.com>
References: <95f6bf9b0802010724u5aa9b48x188af97410237d7@mail.gmail.com>
	<162867790802010933m4f3e2808w405590b26d31d402@mail.gmail.com>

Yes, you got me well. That's exactly what I was trying to achieve. Thank
you.


2008/2/1, Pavel Stehule <pavel.stehule@gmail.com>:
>
> Hello
>
> I am not sure if I understand well.
>
> On 01/02/2008, Marcin Krawczyk <jankes.mk@gmail.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
> >
>

view thread (3+ messages)

Message-ID: <95f6bf9b0802020048r336ba75etb2cf7508d0098854@mail.gmail.com>
Permalink:  ../95f6bf9b0802020048r336ba75etb2cf7508d0098854@mail.gmail.com/
Also on:    postgresql.org/message-id/95f6bf9b0802020048r336ba75etb2cf7508d0098854@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jankes.mk@gmail.com, pavel.stehule@gmail.com
  Subject: Re: aggregate reverse
  In-Reply-To: <95f6bf9b0802020048r336ba75etb2cf7508d0098854@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox