Values of temporal types must satisfy several constraints so that they are well defined. These constraints are given next.
The constraints on the base type and the timestamptz type must be satisfied.
A sequence value must be composed of at least one instant value.
An instantaneous sequence value or a sequence value with discrete interpolation must have inclusive lower and upper bounds.
In a sequence value, the timestamps of the composing instants must be different and ordered.
In a sequence value with step interpolation, the last two values must be equal if upper bound is exclusive.
A sequence set value must be composed of at least one sequence value.
In a sequence set value, the composing sequence values must be non overlapping and ordered.
An error is raised whenever one of these constraints are not satisfied. Examples of incorrect temporal values are as follows.
-- Incorrect value for base type
SELECT tbool '1.5@2001-01-01 08:00:00';
-- Base type value is not a point
SELECT tgeompoint 'Linestring(0 0,1 1)@2001-01-01 08:05:00';
-- Incorrect timestamp
SELECT tint '2@2001-02-31 08:00:00';
-- Empty sequence
SELECT tint '';
-- Incorrect bounds for instantaneous sequence
SELECT tint '[1@2001-01-01 09:00:00)';
-- Duplicate timestamps
SELECT tint '[1@2001-01-01 08:00:00, 2@2001-01-01 08:00:00]';
-- Unordered timestamps
SELECT tint '[1@2001-01-01 08:10:00, 2@2001-01-01 08:00:00]';
-- Incorrect end value for step interpolation
SELECT tint '[1@2001-01-01 08:00:00, 2@2001-01-01 08:10:00)';
-- Empty sequence set
SELECT tint '{[]}';
-- Duplicate timestamps
SELECT tint '{1@2001-01-01 08:00:00, 2@2001-01-01 08:00:00}';
-- Overlapping periods
SELECT tint '{[1@2001-01-01 08:00:00, 1@2001-01-01 10:00:00),
[2@2001-01-01 09:00:00, 2@2001-01-01 11:00:00)}';