Next: Defining New Type Converters, Previous: Consulting Existing Type Converters, Up: Types Conversion
For the most part, the built-in converters map Scheme types to PostgreSQL types almost transparently (see Consulting Existing Type Converters). This section lists the PostgreSQL types not (yet) covered, describes the major weakness in the mapping approach, and then finally touches upon some of the rough edges to be found in selected cases. We hope to resolve these issues (and thus be able to revise this section significantly) before Guile-PG 1.0 is released.
Converters for the following PostgreSQL 7.4.17 types are not provided. (Dot-separated numbers indicate a section in the PostgreSQL User's Guide describing the type.)
double precisiondouble instead of
double precision.
moneycharacter varying (n)char (n)varchar instead of
character varying, and character instead of char.
timestamp [ (p) ] with time zoneinterval [ (p) ]datetime [ (p) ] with time zonetime [ (p) ] without time zonepointlinelsegboxpathpolygoncirclebit (n)bit varying (n)regprocregprocedureregoperregoperatorregclassregtyperecordanyanyarrayvoidtriggerlanguage_handlercstringinternalopaqueThe large table above hints at the major weakness in Guile-PG's type mapping approach: the names of type converters and the names of the PostgreSQL types are not decoupled at all. This has several negative consequences:
double precision has a space; Guile-PG can
provide double, but now there is ambiguity upon reflection, and
the single-table abstraction #:create method fails.
inet object to be a two-element
vector; perhaps client code uses a cons or simply one number, since all its
inet objects are host addresses (constant netmask). Sure, it is no big
deal to box/unbox, but that's an extra level of conversion that the whole
system was trying to avoid in the first place.
inet-host, but the
single-table abstraction #:create method fails because
it has no way of finding out that this type is based on inet.
The rest of this section is a table delving into some of the more quirky type
converters provided, including those that do not have a PostgreSQL type.
Entries marked NOCREATE indicate that the converter is for a synthetic
type and that it cannot be used in the single-table abstraction to create a
table, either because there is no underlying PostgreSQL type, or because
information about such an underlying type is not (presently) available.
Entries marked INTERNAL are “not intended for use by the general
user”, according to the PostgreSQL User's Guide. Entries marked
EXPERIMENTAL should probably be avoided unless you are interested in
debugging Guile-PG itself.
doubledouble precision.
charname"char" type (name
includes the double quotes) that this type (name does not include the double
quotes) mimics.
timestamptimestamp (0) without
time zone.
inetcidrinet or cidr object to be a
vector of two elements #(address maskcount) where
address is a positive integer zero through #xffffffff (32
bits) and maskcount is the number of bits in the netmask. If
maskcount has value 32, that indicates that address is a
host address (not a network).
inet-hostinet-host converter can be used to access data of
PostgreSQL type inet or cidr when all the data values have a
netmask value of 32. The Scheme inet-host object is a positive integer
zero through #xffffffff (32 bits).
aclitem(database postgres-meta)
in a pass-through (semantically opaque) manner. (This is another way
of saying we don't know what the hell this is good for, but there it is,
anyway. ;-)