-
Notifications
You must be signed in to change notification settings - Fork 80
Description
The current way to support new types seems to hard code the typelem
in PqResult.h. For types from extensions (such as Postgis), it seems the typelem
returned can be quite variable (see #114 as an example). I believe the typelem
is not a garantee of the typname
in PostgreSQL; they are maintained in pg_types
table (select * from pg_type;
).
My understanding is that to support special types and facilitate extending RPostgres, it would require to have a generic type conversion function that could return the typelem
along with R type. I'm brainstorming here, but maybe passing something like e.g. structure(c("A", "B"), class=c("18", "character"))
, where "18" is PostgreSQL typelem
of CHAR
, to a generic finalize_type()
could work. Even kinder would be to lookup the typname
(and cache it) rather than provide the typelem
.
The Unknown field type
warning would only be thrown by the generic finalize_type
. But the important part is that I couldn't find a way to access the typelem
from outside, and I believe it is required to support special types.