Restringir al (complemento del) valor mínimo o máximo
atMin(torder) → torder
atMax(torder) → torder
minusMin(torder) → torder
minusMax(torder) → torder
La función devuelve un valor nulo si el valor mínimo o máximo sólo ocurre en límites exclusivos.
SELECT atMin(tint '{1@2001-01-01, 2@2001-01-03, 1@2001-01-05}'); -- {1@2001-01-01, 1@2001-01-05} SELECT atMin(tint '(1@2001-01-01, 3@2001-01-03]'); -- {(1@2001-01-01, 1@2001-01-03)} SELECT atMin(tfloat '(1@2001-01-01, 3@2001-01-03]'); -- NULL SELECT atMin(ttext '{(AA@2001-01-01, AA@2001-01-03), (BB@2001-01-03, AA@2001-01-05]}'); -- {(AA@2001-01-01, AA@2001-01-03), [AA@2001-01-05]} SELECT atMax(tint '{1@2001-01-01, 2@2001-01-03, 3@2001-01-05}'); -- {3@2001-01-05} SELECT atMax(tfloat '(1@2001-01-01, 3@2001-01-03)'); -- NULL SELECT atMax(tfloat '{(2@2001-01-01, 1@2001-01-03), [2@2001-01-03, 2@2001-01-05)}'); -- {[2@2001-01-03, 2@2001-01-05]} SELECT atMax(ttext '{(AA@2001-01-01, AA@2001-01-03), (BB@2001-01-03, AA@2001-01-05]}'); -- {("BB"@2001-01-03, "BB"@2001-01-05)}
SELECT minusMin(tint '{1@2001-01-01, 2@2001-01-03, 1@2001-01-05}'); -- {2@2001-01-03} SELECT minusMin(tfloat '[1@2001-01-01, 3@2001-01-03]'); -- {(1@2001-01-01, 3@2001-01-03]} SELECT minusMin(tfloat '(1@2001-01-01, 3@2001-01-03)'); -- {(1@2001-01-01, 3@2001-01-03)} SELECT minusMin(tint '{[1@2001-01-01, 1@2001-01-03), (1@2001-01-03, 1@2001-01-05)}'); -- NULL SELECT minusMax(tint '{1@2001-01-01, 2@2001-01-03, 3@2001-01-05}'); -- {1@2001-01-01, 2@2001-01-03} SELECT minusMax(tfloat '[1@2001-01-01, 3@2001-01-03]'); -- {[1@2001-01-01, 3@2001-01-03)} SELECT minusMax(tfloat '(1@2001-01-01, 3@2001-01-03)'); -- {(1@2001-01-01, 3@2001-01-03)} SELECT minusMax(tfloat '{[2@2001-01-01, 1@2001-01-03), [2@2001-01-03, 2@2001-01-05)}'); -- {(2@2001-01-01, 1@2001-01-03)} SELECT minusMax(tfloat '{[1@2001-01-01, 3@2001-01-03), (3@2001-01-03, 1@2001-01-05)}'); -- {[1@2001-01-01, 3@2001-01-03), (3@2001-01-03, 1@2001-01-05)}
Restringir a (al complemento de) un tbox
atTbox(tnumber,tbox) → tnumber
minusTbox(tnumber,tbox) → tnumber
When the bounding box has both value and time dimensions, the functions restrict the temporal number with respect to the value and the time extents of the box.
SELECT atTbox(tfloat '[0@2001-01-01, 3@2001-01-04)', tbox 'TBOXFLOAT XT((0,2),[2001-01-02, 2001-01-04])'); -- {[1@2001-01-02, 2@2001-01-03]}
SELECT minusTbox(tfloat '[1@2001-01-01, 4@2001-01-04)', 'TBOXFLOAT XT((1,4),[2001-01-03, 2001-01-04])'); -- {[1@2001-01-01, 3@2001-01-03)} WITH temp(temp, box) AS ( SELECT tfloat '[1@2001-01-01, 4@2001-01-04)', tbox 'TBOXFLOAT XT((1,2),[2001-01-03, 2001-01-04])' ) SELECT minusValues(minusTime(temp, box::tstzspan), box::floatspan) FROM temp; -- {[1@2001-01-01], [2@2001-01-02, 3@2001-01-03)}