Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D33942E01A8 for ; Fri, 1 Feb 2008 13:34:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 35559-10 for ; Fri, 1 Feb 2008 13:33:57 -0400 (AST) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.187]) by postgresql.org (Postfix) with ESMTP id C4C552E00AE for ; Fri, 1 Feb 2008 13:33:56 -0400 (AST) Received: by fk-out-0910.google.com with SMTP id b27so1352335fka.3 for ; Fri, 01 Feb 2008 09:33:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=m04zQPErDvg0AcT2WIlYdJkZubKOUlKkKWtGK3RwFCI=; b=DhzBmL8wSuwPVLhp4SRgetUswXwAO4LJ66km8Esx8UL167yDyuG2ULjHNgNSMfUAFFMB0OvbGm4y4JHuQqEH0Jxw6uQJFLVIh3aPSel0mOsF+r6tpZ5MbQiszR4PU9XDZBsvqt76c5CTgznJmC9VopzIze2Cw4NkPx6UpXv3peU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=duTBeiAF4dmAQ6JXKQFllysfiJBXG1Won/Vc1IwJPw4Qxp8NqaFPrlplNzZQypXyILVLCUUBoD7vjWKhfz0kcOeM7mMH9+DebB048fP7hl1C/4puDLlWXI1aziZ4+2zkSNM88ChctJFf36LSPhg9Y/DENsWZBicxelR0KyLdEUM= Received: by 10.78.83.15 with SMTP id g15mr6670223hub.6.1201887234752; Fri, 01 Feb 2008 09:33:54 -0800 (PST) Received: by 10.78.35.7 with HTTP; Fri, 1 Feb 2008 09:33:54 -0800 (PST) Message-ID: <162867790802010933m4f3e2808w405590b26d31d402@mail.gmail.com> Date: Fri, 1 Feb 2008 18:33:54 +0100 From: "Pavel Stehule" To: "Marcin Krawczyk" Subject: Re: aggregate reverse Cc: pgsql-sql@postgresql.org In-Reply-To: <95f6bf9b0802010724u5aa9b48x188af97410237d7@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <95f6bf9b0802010724u5aa9b48x188af97410237d7@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/2 X-Sequence-Number: 30093 Hello I am not sure if I understand well. On 01/02/2008, Marcin Krawczyk 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 >