Next: Defining New Type Converters, Previous: Consulting Existing Type Converters, Up: Types Conversion [Contents][Index]
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 precisionNumeric Types (8.1). Guile-PG provides double instead of
double precision.
moneyMonetary Type (8.2). Since PostgreSQL itself deprecates this type, it is unlikely Guile-PG will support it ever.
character varying (n)char (n)Character Types (8.3). Guile-PG provides varchar instead of
character varying, and character instead of char.
timestamp [ (p) ] with time zoneinterval [ (p) ]datetime [ (p) ] with time zonetime [ (p) ] without time zoneDate/Time Types (8.5).
pointlinelsegboxpathpolygoncircleGeometric Types (8.7).
bit (n)bit varying (n)Bit String Types (8.9).
regprocregprocedureregoperregoperatorregclassregtypeObject Identifier Types (8.11).
recordanyanyarrayvoidtriggerlanguage_handlercstringinternalopaquePseudo-Types (8.12).
The 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.
doubleNOCREATE. This can be used to access data of PostgreSQL type
double precision.
charnameNOCREATE, INTERNAL. PostgreSQL actually provides a "char" type (name
includes the double quotes) that this type (name does not include the double
quotes) mimics.
timestampThis can be used to access data of PostgreSQL type timestamp (0) without
time zone.
inetcidrGuile has no native type that aggregates the address and the netmask, so
Guile-PG defines the Scheme inet 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-hostNOCREATE. The inet-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).
aclitemEXPERIMENTAL. Presently used by module (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. ;-)
Next: Defining New Type Converters, Previous: Consulting Existing Type Converters, Up: Types Conversion [Contents][Index]