Return the values of the temporal number or geometry as a set
valueSet(tnumber, tgeo) → {numset,geoset}
SELECT valueSet(tint '[1@2001-01-01, 2@2001-01-03]');
-- {1, 2}
SELECT valueSet(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 4@2001-01-05)}');
-- {1, 2, 3, 4}
SELECT asText(valueSet(tgeompoint '{[Point(0 0)@2001-01-01, Point(0 1)@2001-01-02),
[Point(0 1)@2001-01-03, Point(1 1)@2001-01-04)}'));
-- {"POINT(0 0)", "POINT(1 1)", "POINT(0 1)"}
SELECT asText(valueSet(tgeography
'{[Point(0 0)@2001-01-01, Linestring(0 0,1 1)@2001-01-02],
[Point(1 1)@2001-01-03, Linestring(0 0,1 1)@2001-01-04]}'));
-- {"POINT(0 0)", "LINESTRING(0 0,1 1)", "POINT(1 1)"}
Return the minimum, maximum, or average value
minValue(torder) → base
maxValue(torder) → base
avgValue(tnumber) → base
The functions do not take into account whether the bounds are inclusive or not.
SELECT minValue(tfloat '{1@2001-01-01, 2@2001-01-03, 3@2001-01-05}');
-- 1
SELECT maxValue(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}');
-- 5
SELECT avgValue(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}');
-- 2.75
SELECT minValue(ttext '{[A@2001-01-01, B@2001-01-02], [C@2001-01-03, E@2001-01-05]}');
-- A
SELECT maxValue(ttext '{[A@2001-01-01, B@2001-01-02], [C@2001-01-03, E@2001-01-05]}');
-- E
Return the instant with the minimum or maximum value
minInstant(torder) → base
maxInstant(torder) → base
The function does not take into account whether the bounds are inclusive or not. If several instants have the minimum value, the first one is returned.
SELECT minInstant(tfloat '{1@2001-01-01, 2@2001-01-03, 3@2001-01-05}');
-- 1@2001-01-01
SELECT maxInstant(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}');
-- 5@2001-01-05