Restrict to (the complement of) the minimum or maximum value
atMin(torder) → torder
atMax(torder) → torder
minusMin(torder) → torder
minusMax(torder) → torder
The functions returns a NULL value if the minimum value only happens at exclusive bounds.
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)}
Restrict to (the complement of) a tbox
atTbox(tnumber,tbox) → tnumber
minusTbox(tnumber,tbox) → tnumber
Cuando el cuadro delimitador tiene dimensiones tanto de valores como temporales, las funciones restringen el número temporal con respecto al valor y las extensiones temporales del cuadro.
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)}