The bindings described in this section are provided by the specific
modules below, not by db or db/base.
5.1 Datetime Type Utilities
Converts between this library’s date and time values and SRFI 19’s
date values (see srfi/19
). SRFI dates store more
information than SQL dates and times, so converting a SQL time to a
SRFI date, for example, puts zeroes in the year, month, and day
(tm:date 0 0 30 7 0 0 0 0)
(tm:date 0 0 0 0 25 12 1980 0)
(tm:date 0 0 0 0 1 1 1970 0)
Returns the length of interval in seconds.
5.2 Geometric Types
The following structures and functions deal with geometric values
based on the OpenGIS (ISO 19125) model.
Note: Geometric columns defined using the PostGIS extension to
PostgreSQL are not directly supported. Instead, data should be
exchanged in the Well-Known Binary format; conversion of the following
structures to and from WKB format is supported by the
wkb->geometry and geometry->wkb functions.
Represents an OpenGIS Point.
Represents an OpenGIS LineString.
Represents an OpenGIS Polygon.
Represents an OpenGIS MultiPoint, a collection of points.
Represents an OpenGIS MultiLineString, a collection of line-strings.
Represents an OpenGIS MultiPolygon, a collection of polygons.
Represents an OpenGIS GeometryCollection, a collection of
arbitrary geometric values.
is a line-string
consisting of exactly two points (cf OpenGIS Line
is a line-string
first and last points are equal (cf OpenGIS LinearRing
Returns the Well-Known Binary (WKB) encoding of the geometric value
g. The big-endian? argument determines the byte
order used (the WKB format includes byte-order markers, so a robust
client should accept either encoding).
Decodes the Well-Known Binary (WKB) representation of a geometric
5.3 PostgreSQL-specific Types
Represents a PostrgreSQL array. The dimension-lengths and
dimension-lower-bounds fields are both lists of
dimensions elements. By default, PostgreSQL array indexes
start with 1 (not 0), so dimension-lower-bounds is typically
a list of 1s.
Returns the element of arr at the given position. There must
be as many index arguments as the dimension of
arr. Recall that PostgreSQL array indexes usually start with
1, not 0.
Returns a list of arr’s contents. The dimension of
arr must be 1; otherwise an error is raised.
Returns a pg-array
of dimension 1 with the contents of
These structures represent certain of PostgreSQL’s built-in geometric
types that have no appropriate analogue in the OpenGIS model:
, and circle
. The point
PostgreSQL built-in types are represented using
Note: PostgreSQL’s built-in geometric types are distinct from those
provided by the PostGIS extension library (see Geometric Types).