Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Array data and the Perl DBI



I am having problems retrieving data stored in arrays using the Perl DBI. I have noticed some others have had problems like this, and it looked like some fixes were forthcoming. I know how to kludge a fix by specifying each element of the array separately in the query, but that is an unacceptable solution for me. I want to know if there's any way to get this to work as advertised. It fails on the fetch - segmentation fault. Thanks, Kathy

#***********************************************Code***************************
#!/packages/bin/perl
use DBI;

my $dbh=DBI->connect("dbi:Pg:host=$host;dbname=$db;user=$user;password=$passwd");
my $statement="select channels[2] from test_array where ta_key='A'";
my $sth=$dbh->prepare($statement);
$sth->execute();
@answer=$sth->fetchrow_array;
$rc=$sth->finish;
$dbh->disconnect;


#******************************************Table definition *************************
#Table definition
CREATE TABLE test_array (
    ta_key char(1) not null,
    channels numeric(10,4) []
);

insert into test_array (ta_key,channels) values ('A','{1.93,2.0,3.5,5.0,5.666}');





Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group