PostgreSQLa named type is needed, and an operator class is needed for exception constraints. In 9.1, RANGEnot yet implemented.
You can define your own, but this requires a super privilege (that is, it will not work with hosted databases, etc.).
You can try putting timestamps in the fields and define the limit using the intersects ( &&) operator :
CREATE FUNCTION ts_to_box(TIMESTAMPTZ, TIMESTAMPTZ)
RETURNS BOX
AS
$$
SELECT BOX(POINT(DATE_PART('epoch', $1), -1), POINT(DATE_PART('epoch', $2), 1))
$$
LANGUAGE 'sql'
IMMUTABLE;
CREATE TABLE t (
fromts timestamptz,
tots timestamptz,
EXCLUDE USING GIST (ts_to_box(fromts, tots) WITH &&)
);
source
share