Obtener el tamaño de la memoria en bytes
memSize(ttype): integer
SELECT memSize(tint '{1@2012-01-01, 2@2012-01-02, 3@2012-01-03}');
-- 280
Obtener el subtipo temporal
tempSubtype(ttype): {'Instant','InstantSet','Sequence','SequenceSet'}
SELECT tempSubtype(tint '[1@2012-01-01, 2@2012-01-02, 3@2012-01-03]'); -- "Sequence"
Obtener la interpolación
interpolation(ttype): {'Discrete','Stepwise','Linear'}
SELECT interpolation(tfloat '{1@2012-01-01, 2@2012-01-02, 3@2012-01-03}');
-- "Discrete"
SELECT interpolation(tint '[1@2012-01-01, 2@2012-01-02, 3@2012-01-03]');
-- "Stepwise"
SELECT interpolation(tfloat '[1@2012-01-01, 2@2012-01-02, 3@2012-01-03]');
-- "Linear"
SELECT interpolation(tfloat 'Interp=Stepwise;[1@2012-01-01, 2@2012-01-02, 3@2012-01-03]');
-- "Stepwise"
SELECT interpolation(tgeompoint 'Interp=Stepwise;[Point(1 1)@2012-01-01,
Point(2 2)@2012-01-02, Point(3 3)@2012-01-03]');
-- "Stepwise"
Obtener el valor
getValue(ttype_inst): base
SELECT getValue(tint '1@2012-01-01'); -- 1 SELECT ST_AsText(getValue(tgeompoint 'Point(0 0)@2012-01-01')); -- "POINT(0 0)"
Obtener los valores
getValues(ttype): {base[],floatrange[],geo}
SELECT getValues(tint '[1@2012-01-01, 2@2012-01-03]');
-- "{1,2}"
SELECT getValues(tfloat '[1@2012-01-01, 2@2012-01-03)');
-- "{[1,2)}"
SELECT getValues(tfloat '{[1@2012-01-01, 2@2012-01-03), [3@2012-01-03, 4@2012-01-05)}');
-- "{[1,2),[3,4)}"
SELECT getValues(tfloat 'Interp=Stepwise;{[1@2012-01-01, 2@2012-01-02],
[3@2012-01-03, 4@2012-01-05]}');
-- "{"[1,1]","[2,2]","[3,3]","[4,4]"}"
SELECT ST_AsText(getValues(tgeompoint '{[Point(0 0)@2012-01-01, Point(0 1)@2012-01-02),
[Point(0 1)@2012-01-03, Point(1 1)@2012-01-04)}'));
-- "LINESTRING(0 0,0 1,1 1)"
SELECT ST_AsText(getValues(tgeompoint '{[Point(0 0)@2012-01-01, Point(0 1)@2012-01-02),
[Point(1 1)@2012-01-03, Point(2 2)@2012-01-04)}'));
-- "MULTILINESTRING((0 0,0 1),(1 1,2 2)"
SELECT ST_AsText(getValues(tgeompoint 'Interp=Stepwise;{[Point(0 0)@2012-01-01,
Point(0 1)@2012-01-02], [Point(0 1)@2012-01-03, Point(1 1)@2012-01-04]}'));
-- "GEOMETRYCOLLECTION(MULTIPOINT(0 0,0 1),MULTIPOINT(0 1,1 1))"
SELECT ST_AsText(getValues(tgeompoint '{Point(0 0)@2012-01-01, Point(0 1)@2012-01-02}'));
-- "MULTIPOINT(0 0,0 1)"
SELECT ST_AsText(getValues(tgeompoint '{[Point(0 0)@2012-01-01, Point(0 1)@2012-01-02),
[Point(1 1)@2012-01-03, Point(1 1)@2012-01-04),
[Point(2 1)@2012-01-05, Point(2 2)@2012-01-06)}'));
-- "GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,0 1),LINESTRING(2 1,2 2))"
Obtener el valor inicial
startValue(ttype): base
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT startValue(tfloat '(1@2012-01-01, 2@2012-01-03)'); -- 1
Obtener el valor final
endValue(ttype): base
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT endValue(tfloat '{[1@2012-01-01, 2@2012-01-03), [3@2012-01-03, 5@2012-01-05)}');
-- 5
Obtener el valor mínimo
minValue(torder): base
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT minValue(tfloat '{1@2012-01-01, 2@2012-01-03, 3@2012-01-05}');
-- 1
Obtener el valor máximo
maxValue(torder): base
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT maxValue(tfloat '{[1@2012-01-01, 2@2012-01-03), [3@2012-01-03, 5@2012-01-05)}');
-- 5
Obtener el rango de valores
valueRange(tnumber): numrange
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT valueRange(tfloat '{[2@2012-01-01, 1@2012-01-03), [4@2012-01-03, 6@2012-01-05)}');
-- "[1,6]"
SELECT valueRange(tfloat '{1@2012-01-01, 2@2012-01-03, 3@2012-01-05}');
-- "[1,3])"
Obtener el valor en una marca de tiempo
valueAtTimestamp(ttype,timestamptz): base
SELECT valueAtTimestamp(tfloat '[1@2012-01-01, 4@2012-01-04)', '2012-01-02'); -- "2"
Obtener la marca de tiempo
getTimestamp(ttype_inst): timestamptz
SELECT getTimestamp(tint '1@2012-01-01'); -- "2012-01-01"
Obtener el tiempo
getTime(ttype): periodset
SELECT getTime(tint '[1@2012-01-01, 1@2012-01-15)');
-- "{[2012-01-01, 2012-01-15)}"
Obtener el intervalo de tiempo
duration(ttype): interval
SELECT duration(tfloat '[1@2012-01-01, 2@2012-01-03, 2@2012-01-05)');
-- "4 days"
SELECT duration(tfloat '{[1@2012-01-01, 2@2012-01-03), [2@2012-01-04, 2@2012-01-05)}');
-- "3 days"
Obtener el intervalo de tiempo ignorando las posibles brechas de tiempo
timespan(ttype): interval
SELECT timespan(tfloat '{1@2012-01-01, 2@2012-01-03, 2@2012-01-05}');
-- "4 days"
SELECT timespan(tfloat '{[1@2012-01-01, 2@2012-01-03), [2@2012-01-04, 2@2012-01-05)}');
-- "4 days"
Obtener el período en el que está definido el valor temporal ignorando las posibles brechas de tiempo
period(ttype): period
SELECT period(tint '{1@2012-01-01, 2@2012-01-03, 3@2012-01-05}');
-- "[2012-01-01, 2012-01-05]"
SELECT period(tfloat '{[1@2012-01-01, 1@2012-01-02), [2@2012-01-03, 3@2012-01-04)}');
-- "[2012-01-01, 2012-01-04)"
Obtener el número de instantes diferentes
numInstants(ttype): integer
SELECT numInstants(tfloat '{[1@2000-01-01, 2@2000-01-02), (2@2000-01-02, 3@2000-01-03)}');
-- 3
Obtener el instante inicial
startInstant(ttype): ttype_inst
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT startInstant(tfloat '{[1@2000-01-01, 2@2000-01-02),
(2@2000-01-02, 3@2000-01-03)}');
-- "1@2000-01-01"
Obtener el instante final
endInstant(ttype): ttype_inst
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT endInstant(tfloat '{[1@2000-01-01, 2@2000-01-02), (2@2000-01-02, 3@2000-01-03)}');
-- "3@2000-01-03"
Obtener el enésimo instante diferente
instantN(ttype,integer): ttype_inst
SELECT instantN(tfloat '{[1@2000-01-01, 2@2000-01-02), (2@2000-01-02, 3@2000-01-03)}', 3);
-- "3@2000-01-03"
Obtener los instantes diferentes
instants(ttype): ttype_inst[]
SELECT instants(tfloat '{[1@2000-01-01, 2@2000-01-02), (2@2000-01-02, 3@2000-01-03)}');
-- "{"1@2000-01-01","2@2000-01-02","3@2000-01-03"}"
Obtener el número de marcas de tiempo diferentes
numTimestamps(ttype): integer
SELECT numTimestamps(tfloat '{[1@2012-01-01, 2@2012-01-03),
[3@2012-01-03, 5@2012-01-05)}');
-- 3
Obtener la marca de tiempo inicial
startTimestamp(ttype): timestamptz
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT startTimestamp(tfloat '[1@2012-01-01, 2@2012-01-03)'); -- "2012-01-01"
Obtener la marca de tiempo final
endTimestamp(ttype): timestamptz
La función no tiene en cuenta si los límites son inclusivos o no.
SELECT endTimestamp(tfloat '{[1@2012-01-01, 2@2012-01-03),
[3@2012-01-03, 5@2012-01-05)}');
-- "2012-01-05"
Obtener la enésima marca de tiempo diferente
timestampN(ttype,integer): timestamptz
SELECT timestampN(tfloat '{[1@2012-01-01, 2@2012-01-03),
[3@2012-01-03, 5@2012-01-05)}', 3);
-- "2012-01-05"
Obtener las marcas de tiempo diferentes
timestamps(ttype): timestamptz[]
SELECT timestamps(tfloat '{[1@2012-01-01, 2@2012-01-03), [3@2012-01-03, 5@2012-01-05)}');
-- "{"2012-01-01", "2012-01-03", "2012-01-05"}"
Obtener el número de secuencias
numSequences({ttype_seq,ttype_seqset}): integer
SELECT numSequences(tfloat '{[1@2012-01-01, 2@2012-01-03),
[3@2012-01-03, 5@2012-01-05)}');
-- 2
Obtener la secuencia inicial
startSequence({ttype_seq,ttype_seqset}): ttype_seq
SELECT startSequence(tfloat '{[1@2012-01-01, 2@2012-01-03),
[3@2012-01-03, 5@2012-01-05)}');
-- "[1@2012-01-01, 2@2012-01-03)"
Obtener la secuencia final
endSequence({ttype_seq,ttype_seqset}): ttype_seq
SELECT endSequence(tfloat '{[1@2012-01-01, 2@2012-01-03), [3@2012-01-03, 5@2012-01-05)}');
-- "[3@2012-01-03, 5@2012-01-05)"
Obtener la enésima secuencia
sequenceN({ttype_seq,ttype_seqset},integer): ttype_seq
SELECT sequenceN(tfloat '{[1@2012-01-01, 2@2012-01-03),
[3@2012-01-03, 5@2012-01-05)}', 2);
-- "[3@2012-01-03, 5@2012-01-05)"
Obtener las secuencias
sequences({ttype_seq,ttype_seqset}): ttype_seq[]
SELECT sequences(tfloat '{[1@2012-01-01, 2@2012-01-03), [3@2012-01-03, 5@2012-01-05)}');
-- "{"[1@2012-01-01, 2@2012-01-03)", "[3@2012-01-03, 5@2012-01-05)"}"
Obtener los segmentos
segments({ttype_seq,ttype_seqset}): ttype_seq[]
SELECT segments(tint '{[1@2012-01-01, 3@2012-01-02, 2@2012-01-03],
(3@2012-01-03, 5@2012-01-05]}');
-- {"[1@2012-01-01, 1@2012-01-02)","[3@2012-01-02, 3@2012-01-03)","[2@2012-01-03]",
"(3@2012-01-03, 3@2012-01-05)","[5@2012-01-05]"}
SELECT segments(tfloat '{[1@2012-01-01, 3@2012-01-02, 2@2012-01-03],
(3@2012-01-03, 5@2012-01-05]}');
-- {"[1@2012-01-01, 3@2012-01-02)","[3@2012-01-02, 2@2012-01-03]",
"(3@2012-01-03, 5@2012-01-05]"}
¿Se cruza el valor temporal con la marca de tiempo?
intersectsTimestamp(ttype,timestamptz): boolean
SELECT intersectsTimestamp(tint '[1@2012-01-01, 1@2012-01-15)', timestamptz '2012-01-03'); -- true
¿Se cruza el valor temporal con el conjunto de marcas tiempo?
intersectsTimestampSet(ttype,timestampset): boolean
SELECT intersectsTimestampSet(tint '[1@2012-01-01, 1@2012-01-15)',
timestampset '{2012-01-01, 2012-01-03}');
-- true
¿Se cruza el valor temporal con el período?
intersectsPeriod(ttype,period): boolean
SELECT intersectsPeriod(tint '[1@2012-01-01, 1@2012-01-04)', period '[2012-01-01,2012-01-05)'); -- true
¿Se cruza el valor temporal con el conjunto de períodos?
intersectsPeriodSet(ttype,periodset): boolean
SELECT intersectsPeriodSet(tbool '[t@2012-01-01, f@2012-01-15]',
periodset '{[2012-01-01, 2012-01-03), [2012-01-05, 2012-01-07)}');
-- true
Obtener el promedio ponderado en el tiempo
twAvg(tnumber): float
SELECT twAvg(tfloat '{[1@2012-01-01, 2@2012-01-03), [2@2012-01-04, 2@2012-01-06)}');
-- 1.75