Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id EB52D2E037C for ; Sun, 23 Dec 2007 17:27:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 37632-02 for ; Sun, 23 Dec 2007 17:27:08 -0400 (AST) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.186]) by postgresql.org (Postfix) with ESMTP id 8736C2E00CB for ; Sun, 23 Dec 2007 17:27:11 -0400 (AST) Received: by mu-out-0910.google.com with SMTP id i10so1132754mue.5 for ; Sun, 23 Dec 2007 13:27:10 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=LHP8ruVpYaqrmrXu8g7bd5VdHjw5sbdL7Rb7Vf2Ck6E=; b=qRVH7avyDNjthzEgDEU8bw3wNjzWjr+w48mMgC0nqgqTPUu6povQ2eTWdqHdUZ8uItzXlqeru/zRvZsgGqLlX0TZrAlC50q7vfgpzfgk5O4ltDWmZYNqXtLLh94VZAoaL9GB9D44vDupa4sVjYeG7C0/y+3tfXoM9+w8wCa5H5k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=GVJ1LUFvrTP3vyH8MzJ608tUIqVQUARYa/FFcDiG9dQ7oe5OaOmc0dyEDmFXaMHMJ1/9eK5CoTEWyCbEruVdSrjoVIKxCiSAHWBNeDiOTmGyJ3mXuSDk1DxirF+5OY0IOz0i8LgmWAKDRmMrUYq8e8KeBPjppy2fj4q8aL17WSk= Received: by 10.78.142.14 with SMTP id p14mr4895469hud.75.1198445229828; Sun, 23 Dec 2007 13:27:09 -0800 (PST) Received: by 10.78.35.10 with HTTP; Sun, 23 Dec 2007 13:27:09 -0800 (PST) Message-ID: <162867790712231327g774b8c5ld488113a3a8252e9@mail.gmail.com> Date: Sun, 23 Dec 2007 22:27:09 +0100 From: "Pavel Stehule" To: pgsql-sql@postgresql.org Subject: Re: returning an array as a list fo single-column rows? In-Reply-To: <20071223205557.GA14403@apartia.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20071223205557.GA14403@apartia.fr> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/122 X-Sequence-Number: 29814 On 23/12/2007, Louis-David Mitterrand wrote: > Hi, > > is there a way to return a Pg array as a list of single-column row > values? > > I am trying to circumvent DBI's lack of support for native database > arrays and return the list of values from an ENUM as a perl array. > > Thanks, > you can solve this problem with conversion to string with const separator Like: postgres=# select array_to_string(array[1,2,3,4],'|'); array_to_string ----------------- 1|2|3|4 (1 row) [pavel@localhost ~]$ perl @a = split(/\|/, "1|2|3"); print $a[1]; Regards Pavel