Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parsing PostgreSQL array datatype as array to perl

I have a of inter-portability problem with parsing PosgreSQL array datatype to perl.

On one machine running PostgreSQL 8.3.7 on SUSE Linux 4.3.2 and perl v5.10.0 the postgres array datatype is parsed as perl array and on other machine running PostgreSQL 8.4.4 on Red Hat 4.1.2-46 and perl v5.8.8 the same datatype is parsed as a string representing an posgres array eg. '{{4,315}}'. In both cases same very simple code is used.

use DBI;
$dbh = DBI->connect(DBI:pg [...]);
$res = $dbh -> selectall_arrayref(select [...]);

And now the questions:

How can I force one behavior, preferably the former one (parsed as perl array)? On what does this behavior depend? (perl version? driver? postgres settings?, postgres version?)

like image 780
Damian DK Avatar asked Jan 22 '26 00:01

Damian DK


1 Answers

Well, the official docs say you must set $dbh->{pg_expand_array} to a true value.

I haven't checked it myself though.

like image 94
Dallaylaen Avatar answered Jan 23 '26 20:01

Dallaylaen