From: Pavel Stehule <pavel.stehule@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: returning an array as a list fo single-column rows?
Date: Sun, 23 Dec 2007 22:27:09 +0100
Message-ID: <162867790712231327g774b8c5ld488113a3a8252e9@mail.gmail.com> (raw)
In-Reply-To: <20071223205557.GA14403@apartia.fr>
References: <20071223205557.GA14403@apartia.fr>
On 23/12/2007, Louis-David Mitterrand
<vindex+lists-pgsql-sql@apartia.org> 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
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: pavel.stehule@gmail.com
Subject: Re: returning an array as a list fo single-column rows?
In-Reply-To: <162867790712231327g774b8c5ld488113a3a8252e9@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