Values of temporal types must satisfy several constraints so that they are well defined. These constraints are given next.
The constraints on the corresponding base type and timestamptz
types must be satisfied.
A temporal sequence value must be composed of at least one instant value.
An instantaneous temporal sequence value must have inclusive lower and upper bounds.
In a temporal sequence value, the timestamps of the composing instants must be different and ordered.
In a temporal sequence value with stepwise interpolation, the last two values must be equal if upper bound is exclusive.
A temporal set value must be composed of at least one temporal unit value.
In a temporal instant set value, the composing instants must be different and ordered. This implies that the temporal extent of a temporal instant set value is an ordered set of timestamptz
values without duplicates.
In a temporal sequence set value, the composing sequence values must be non overlapping and ordered. This implies that the temporal extent of a temporal sequence set value is an ordered set of disjoint periods.
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 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 SELECT tint '[1@2001-01-01 08:00:00, 2@2001-01-01 08:10:00)'; -- empty temporal sequence set value SELECT tints(ARRAY[]); -- duplicate timestamps SELECT tinti(ARRAY[tint '1@2001-01-01 08:00:00', '2@2001-01-01 08:00:00']); -- overlapping periods SELECT tints(ARRAY[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)']);