开发者

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 a开发者_Go百科rray 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?)


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

I haven't checked it myself though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜