Getting real arrays from array fields in Perl

From: Alvar Freude <alvar(dot)freude(at)merz-akademie(dot)de>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Getting real arrays from array fields in Perl
Date: 2000-11-14 21:07:39
Message-ID: 3A11A99B.D3A0D0BE@merz-akademie.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hello,

i have created a table containing arrays like this:

CREATE TABLE arraytest
(
id SERIAL,
array int8[],
value text
)

I use the DBI interface in Perl to handle the database. If i select
arrays in the database, it returns strings instead of real Perl array
refereneces:

my $arrayref = $db_p->selectall_arrayref("SELECT * FROM arraytest");
use Data::Dumper;
print Dumper($arrayref);

The result is:

$VAR1 = [
[
1,
'{23,24,25,26}',
'foo'
],
[
2,
'{1,2,3,4}',
'bar'
]
];

I want a structure containing real arrayrefs like this:

$VAR1 = [
[
1,
[ 23,24,25,26 ],
'foo'
],
[
2,
[ 1,2,3,4 ],
'bar'
]
];

Is there an option to get the desired behaviour? I couldn't find
anything in the documentation of Postgres and DBD::Pg.

Thank you
Alvar

--
Alvar C.H. Freude | alvar(dot)freude(at)merz-akademie(dot)de

Demo: http://www.online-demonstration.org/ | Mach mit!
Blast-DE: http://www.assoziations-blaster.de/ | Blast-Dich-Fit
Blast-EN: http://www.a-blast.org/ | Blast/english

Browse pgsql-interfaces by date

  From Date Subject
Next Message Scott Muir 2000-11-15 00:42:47 PGSQL and Image Magick
Previous Message Adam Lang 2000-11-14 20:06:09 Re: OT: Heterogenous networks