Open FGasper opened 10 years ago
Just to clarify, the following comes from a Perl test:
diag explain $dbh->selectall_arrayref(q{SELECT ARRAY['haha','h,"h']});
… and it gives:
# [
# [
# '{haha,"h,\\"h"}'
# ]
# ]
Hi there. I’d definitely go with “there’s currently no special support for values of Postgres array types”, but it’s up to you whether you call that a bug or simply a nonexistent feature. :-)
If you’re interested in adding such array support, the starting point at the DBD::PgPP side of things is probably https://github.com/arc/dbd-pgpp/blob/master/lib/DBD/PgPP.pm#L1349
You’ll also need to deal with finding which OIDs correspond to array types. That information could be looked up in the pg_type
table in the system catalog, but that’s probably not something to be done on every query (or even every connection). Instead I’d suggest statically generating the list of type OIDs from a copy of the Postgres sources, and shipping the generated data as part of DBD::PgPP; that’s roughly what the Perl script embedded in the types.c
file from DBD::Pg does. Doing that would also allow replacing the hard-coded OIDs 16 (for bool) and 17 (for bytea) round line 1349.
$dbh->selectrow_array(q{SELECT ARRAY['haha','h,"h']});
… is returning a Perl string for me rather than an array.
Is this a known bug?