Array reference error after updating PostgreSQL from version 10 to 12
gauravthethinker opened this issue · 1 comments
Recently we have upgraded PostgreSQL from 10.14 to 12.7 after that we have started getting error from PG.pm .
Can't use an undefined value as an ARRAY reference at /usr/lib64/perl5/vendor_perl/DBD/Pg.pm line 533.
Below is the sample code which I am trying to run
my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 })
or die $DBI::errstr;
print "Opened database successfully\n";
my $RetColList;
my $sth = $dbh->column_info(undef, undef, "table_name", undef);
my $colref = $sth->fetchall_arrayref([3]);
my @Collist = @$colref;
foreach my $Col ( @Collist ) {
$RetColList= $RetColList . $Col->[0].",";
print "Debug : Inside GetListColumns RetColList=$RetColList\n";
}
$RetColList =~ s/rowid,//;
chop $RetColList;
print $RetColList;
Can you suggest what we can do to fix this issue . I also checked the latest version from Amazon Linux 2 repo "amzn2-core" is installed on my host
perl-DBD-Pg-2.19.3-4.amzn2.0.2.x86_64
DBD::PG 2.19.3 is from August 2012, 7 years before the release of PostgreSQL 12.
To use PostgreSQL 12, you need DBD::Pg 3.8.0 or newer.