David E. Wheeler wrote:
On Sep 7, 2009, at 6:29 PM, Alvar Freude wrote:
I tried to set an "PG_ANYARRAY" or "PG_TEXTARRAY" type manually with
->bind_col(), but this does not help.
Any ideas how I can get an array for this?
Or is there a PostgreSQL Array parser? ;-)
I believe that this is a deficiency in DBD::Pg. Another deficiency is
in its inability to determine that a user-defined type should be
converted to utf8 when pg_enable_utf8 is set, such as for the CITEXT
contrib type (discussion here:
http://markmail.org/message/mqqz76vdlxibyoyw#query:DBD%3A%3APg%20citext+page:1+mid:mqqz76vdlxibyoyw+state:results).
The issue is that DBD::Pg needs to be smarter about identifying data
types and data type categories (citext is of category "S", for string
in 8.4 and later). At least, that's my best guess.
No doubt it's possible to have DBD::Pg learn about user-defined
composites and arrays of them, although the code for doing so might get
a bit elaborate, but how would it handle a type defined in C, the
representation of which it has no way of knowing about at all? I think
we have to accept that the existence of type extensibility in Postgres
means that there will be at least some types that DBD::Pg has to treat
as opaque bits of text.
That's not to say that it shouldn't learn about some types in contrib
like citext and hstore.
cheers
andrew