Devuelve el tamaño de la memoria en bytes
memSize(ttype) → integer
SELECT memSize(tint '{1@2001-01-01, 2@2001-01-02, 3@2001-01-03}');
-- 176
Devuelve el subtipo temporal
tempSubtype(ttype) → {'Instant','Sequence','SequenceSet'}
SELECT tempSubtype(tint '[1@2001-01-01, 2@2001-01-02, 3@2001-01-03]'); -- Sequence
Devuelve la interpolación
interp(ttype) → {'None','Discrete','Step','Linear'}
SELECT interp(tbool 'true@2001-01-01');
-- None
SELECT interp(tfloat '{1@2001-01-01, 2@2001-01-02, 3@2001-01-03}');
-- Discrete
SELECT interp(tint '[1@2001-01-01, 2@2001-01-02, 3@2001-01-03]');
-- Step
SELECT interp(tfloat '[1@2001-01-01, 2@2001-01-02, 3@2001-01-03]');
-- Linear
SELECT interp(tfloat 'Interp=Step;[1@2001-01-01, 2@2001-01-02, 3@2001-01-03]');
-- Step
SELECT interp(tgeompoint 'Interp=Step;[Point(1 1)@2001-01-01,
Point(2 2)@2001-01-02, Point(3 3)@2001-01-03]');
-- Step
SELECT interp(tgeometry '[Point(1 1)@2001-01-01,
Linestring(1 1,2 2)@2001-01-02, Polygon((3 3,4 4,5 3,3 3))@2001-01-03]');
-- Step
Devuelve el valor o la marca de tiempo de un instantes
getValue(ttypeInst) → base
getTimestamp(ttypeInst) → timestamptz
SELECT getValue(tint '1@2001-01-01'); -- 1 SELECT getTimestamp(tfloat '1@2001-01-01'); -- 2001-01-01
Devuelve los valores o el tiempo en el que se define el valor temporal
getValues(talpha) → {bool[],spanset,textset}
getTime(ttype) → tstzspanset
SELECT getValues(tbool '[false@2001-01-01, true@2001-01-02, false@2001-01-03]');
-- {f,t}
SELECT getValues(tint '[1@2001-01-01, 3@2001-01-02, 1@2001-01-03]');
-- {[1, 2), [3, 4)}
SELECT getValues(tint '{[1@2001-01-01, 2@2001-01-02, 1@2001-01-03],
[4@2001-01-04, 4@2001-01-05]}');
-- {[1, 3), [4, 5)}
SELECT getValues(tfloat '{1@2001-01-01, 2@2001-01-02, 1@2001-01-03}');
-- {[1, 1], [2, 2]}
SELECT getValues(tfloat 'Interp=Step;{[1@2001-01-01, 2@2001-01-02, 1@2001-01-03],
[3@2001-01-04, 3@2001-01-05]}');
-- {[1, 1], [2, 2], [3, 3]}
SELECT getValues(tfloat '[1@2001-01-01, 2@2001-01-02, 1@2001-01-03]');
-- {[1, 2]}
SELECT getValues(tfloat '{[1@2001-01-01, 2@2001-01-02, 1@2001-01-03],
[3@2001-01-04, 3@2001-01-05]}');
-- {[1, 2], [3, 3]}
SELECT getTime(ttext 'walking@2001-01-01');
-- {[2001-01-01, 2001-01-01]}
SELECT getTime(tfloat '{1@2001-01-01, 2@2001-01-02, 1@2001-01-03}');
-- {[2001-01-01, 2001-01-01], [2001-01-02, 2001-01-02], [2001-01-03, 2001-01-03]}
SELECT getTime(tint '[1@2001-01-01, 1@2001-01-15)');
-- {[2001-01-01, 2001-01-15)}
SELECT getTime(tfloat '{[1@2001-01-01, 1@2001-01-10), [12@2001-01-12, 12@2001-01-15]}');
-- {[2001-01-01, 2001-01-10), [2001-01-12, 2001-01-15]}
Devuelve el valor inicial, final, o enésimo
startValue(ttype) → base
endValue(ttype) → base
valueN(ttype,int) → base
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT startValue(tfloat '(1@2001-01-01, 2@2001-01-03)');
-- 1
SELECT endValue(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}');
-- 5
SELECT valueN(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}', 3);
-- 3
Devuelve el valor en una marca de tiempo
valueAtTimestamp(ttype,timestamptz) → base
SELECT valueAtTimestamp(tfloat '[1@2001-01-01, 4@2001-01-04)', '2001-01-02'); -- 2
Devuelve el intervalo de tiempo
duration(ttype,boundspan=false) → interval
Se puede poner en verdadero un parámetro adicional para calcular la duración del período limitador, ignorando así los posibles intervalos de tiempo
SELECT duration(tfloat '{1@2001-01-01, 2@2001-01-03, 2@2001-01-05}');
-- 00:00:00
SELECT duration(tfloat '{1@2001-01-01, 2@2001-01-03, 2@2001-01-05}', true);
-- 4 days
SELECT duration(tfloat '[1@2001-01-01, 2@2001-01-03, 2@2001-01-05)');
-- 4 days
SELECT duration(tfloat '{[1@2001-01-01, 2@2001-01-03), [2@2001-01-04, 2@2001-01-05)}');
-- 3 days
SELECT duration(tfloat '{[1@2001-01-01, 2@2001-01-03), [2@2001-01-04, 2@2001-01-05)}',
true);
-- 4 days
¿Es el instante inicial/final inclusivo?
lowerInc(ttype) → bool
upperInc(ttype) → bool
SELECT lowerInc(tint '[1@2001-01-01, 2@2001-01-02)');
-- true
SELECT upperInc(tfloat '{[1@2001-01-01, 2@2001-01-02), (2@2001-01-02, 3@2001-01-03)}');
-- false
Devuelve el número o los instantes diferentes
numInstants(ttype) → integer
instants(ttype) → ttypeInst[]
SELECT numInstants(tfloat '{[1@2001-01-01, 2@2001-01-02), (2@2001-01-02, 3@2001-01-03)}');
-- 3
SELECT instants(tfloat '{[1@2001-01-01, 2@2001-01-02), (2@2001-01-02, 3@2001-01-03)}');
-- {"1@2001-01-01","2@2001-01-02","3@2001-01-03"}
Devuelve el instante inicial, final o enésimo
startInstant(ttype) → ttypeInst
endInstant(ttype) → ttypeInst
instantN(ttype,integer) → ttypeInst
Las funciones no tienen en cuenta si los límites son inclusivos o no.
SELECT startInstant(tfloat '{[1@2001-01-01, 2@2001-01-02),
(2@2001-01-02, 3@2001-01-03)}');
-- 1@2001-01-01
SELECT endInstant(tfloat '{[1@2001-01-01, 2@2001-01-02), (2@2001-01-02, 3@2001-01-03)}');
-- 3@2001-01-03
SELECT instantN(tfloat '{[1@2001-01-01, 2@2001-01-02), (2@2001-01-02, 3@2001-01-03)}', 3);
-- 3@2001-01-03
Devuelve el número o las marcas de tiempo diferentes
numTimestamps(ttype) → integer
timestamps(ttype) → timestamptz[]
SELECT numTimestamps(tfloat '{[1@2001-01-01, 2@2001-01-03),
[3@2001-01-03, 5@2001-01-05)}');
-- 3
SELECT timestamps(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}');
-- {"2001-01-01", "2001-01-03", "2001-01-05"}
Devuelve la marca de tiempo inicial, final o enésima
startTimestamp(ttype) → timestamptz
endTimestamp(ttype) → timestamptz
timestampN(ttype,integer) → timestamptz
Las funciones no tienen en cuenta si los límites son inclusivos o no.
SELECT startTimestamp(tfloat '[1@2001-01-01, 2@2001-01-03)');
-- 2001-01-01
SELECT endTimestamp(tfloat '{[1@2001-01-01, 2@2001-01-03),
[3@2001-01-03, 5@2001-01-05)}');
-- 2001-01-05
SELECT timestampN(tfloat '{[1@2001-01-01, 2@2001-01-03),
[3@2001-01-03, 5@2001-01-05)}', 3);
-- 2001-01-05
Devuelve el número o las secuencias
numSequences({ttypeContSeq,ttypeSeqSet}) → integer
sequences({ttypeContSeq,ttypeSeqSet}) → ttypeContSeq[]
SELECT numSequences(tfloat '{[1@2001-01-01, 2@2001-01-03),
[3@2001-01-03, 5@2001-01-05)}');
-- 2
SELECT sequences(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}');
-- {"[1@2001-01-01, 2@2001-01-03)", "[3@2001-01-03, 5@2001-01-05)"}
Devuelve la secuencia inicial, final, o enésima
startSequence({ttypeContSeq,ttypeSeqSet}) → ttypeContSeq
endSequence({ttypeContSeq,ttypeSeqSet}) → ttypeContSeq
sequenceN({ttypeContSeq,ttypeSeqSet},integer) → ttypeContSeq
SELECT startSequence(tfloat '{[1@2001-01-01, 2@2001-01-03),
[3@2001-01-03, 5@2001-01-05)}');
-- [1@2001-01-01, 2@2001-01-03)
SELECT endSequence(tfloat '{[1@2001-01-01, 2@2001-01-03), [3@2001-01-03, 5@2001-01-05)}');
-- [3@2001-01-03, 5@2001-01-05)
SELECT sequenceN(tfloat '{[1@2001-01-01, 2@2001-01-03),
[3@2001-01-03, 5@2001-01-05)}', 2);
-- [3@2001-01-03, 5@2001-01-05)
Devuelve los segmentos
segments({ttypeContSeq,ttypeSeqSet}) → ttypeContSeq[]
SELECT segments(tint '{[1@2001-01-01, 3@2001-01-02, 2@2001-01-03],
(3@2001-01-03, 5@2001-01-05]}');
/* {"[1@2001-01-01, 1@2001-01-02)","[3@2001-01-02, 3@2001-01-03)","[2@2001-01-03]",
"(3@2001-01-03, 3@2001-01-05)","[5@2001-01-05]"} */
SELECT segments(tfloat '{[1@2001-01-01, 3@2001-01-02, 2@2001-01-03],
(3@2001-01-03, 5@2001-01-05]}');
/* {"[1@2001-01-01, 3@2001-01-02)","[3@2001-01-02, 2@2001-01-03]",
"(3@2001-01-03, 5@2001-01-05]"} */