Array data and the Perl DBI - Mailing list pgsql-interfaces

From Kathy Smith
Subject Array data and the Perl DBI
Date
Msg-id 6.0.3.0.2.20040701171811.02921908@nis-pop.lanl.gov
Whole thread Raw
Responses NULLs in ecpg
List pgsql-interfaces
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}');




pgsql-interfaces by date:

Previous
From: L J Bayuk
Date:
Subject: Re: pgin.tcl pg_exec_prepared slow (was: Released...)
Next
From: jason_e_stewart@users.sourceforge.net
Date:
Subject: DBD::Pg and $sth->{ParamValues}