Operadores topológicos
{tjsonb,tstzspan} {&&, <@#, #@>, ~=, -|-} {tjsonb,tstzspan} → boolean
Los operadores temporales contiene y contenido se marcan con un # para distinguirlos de los operadores JSONB correspondientes.
SELECT tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-01,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-02]' &&
tstzspan '[2001-01-01, 2001-03-01]';
-- true
SELECT tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-01,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-02]' #@>
timestamptz '[2001-01-02]'::tstzspan;
-- true
SELECT tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-01,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-02]' -|-
tjsonb '({"vehicleId": 1, "location": "Point(2 2)"}@2001-01-02,
{"vehicleId": 1, "location": "Point(3 3)"}@2001-01-03]';
-- true
Operadores de posición
{tjsonb,tstzspan} {<<#, &<#, #>>, #&>} {tjsonb,tstzspan} → boolean
SELECT tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-01,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-02]' <<#
tstzspan '[2001-01-01, 2001-03-01]';
-- false
SELECT tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-02,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-03]' #>>
timestamptz '[2001-01-01]'::tstzspan;
-- true
SELECT tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-02,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-03]' #&>
tjsonb '[{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-01,
{"vehicleId": 1, "location": "Point(3 3)"}@2001-01-03]';
-- true