Subject: | pg_expand_array doesn't work for custom data types |
When fetching custom array columns from the database, the arrays are not
expanded into perl arrayrefs, but are returned as strings instead:
use DBI;
my $db = DBI->connect(..);
my $q1 = $db->prepare("SELECT '{1,2}'::int[]");
$q1->execute();
print Dumper $q1->fetchrow_array();
# nicely prints [1,2]
$db->do("CREATE TYPE customint AS ENUM('1','2')");
my $q2 = $db->prepare("SELECT '{1,2}'::customint[]");
$q2->execute();
print Dumper $q2->fetchrow_array();
# prints "{1,2}", not an array
(perl 5.10.1 and DBD::Pg 2.16.1)