pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvar Freude <alvar.freude@merz-akademie.de>
To: pgsql-interfaces@postgresql.org
Subject: Getting real arrays from array fields in Perl
Date: Tue, 14 Nov 2000 22:07:39 +0100
Message-ID: <3A11A99B.D3A0D0BE@merz-akademie.de> (raw)

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.freude@merz-akademie.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



Message-ID: <3A11A99B.D3A0D0BE@merz-akademie.de>
Permalink:  ../3A11A99B.D3A0D0BE@merz-akademie.de/
Also on:    postgresql.org/message-id/3A11A99B.D3A0D0BE@merz-akademie.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-interfaces@postgresql.org
  Cc: alvar.freude@merz-akademie.de
  Subject: Re: Getting real arrays from array fields in Perl
  In-Reply-To: <3A11A99B.D3A0D0BE@merz-akademie.de>
  References: <3A11A99B.D3A0D0BE@merz-akademie.de>

* 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