The traditional comparison operators (=
, <
, and so on) can be applied to box types. Excepted equality and inequality, the other comparison operators are not useful in the real world but allow B-tree indexes to be constructed on bos types. These operators compare first the timestamps and if those are equal, compare the values.
Are the bounding boxes equal?
{tbox, stbox} = {tbox, stbox}: boolean
SELECT tbox 'TBOX((1, 2012-01-01), (1, 2012-01-04))' = tbox 'TBOX((2, 2012-01-03), (2, 2012-01-05))'; -- false
Are the bounding boxes different?
{tbox, stbox} <> {tbox, stbox}: boolean
SELECT tbox 'TBOX((1, 2012-01-01), (1, 2012-01-04))' <> tbox 'TBOX((2, 2012-01-03), (2, 2012-01-05))' -- true
Is the first bounding box less than the second one?
{tbox, stbox} < {tbox, stbox}: boolean
SELECT tbox 'TBOX((1, 2012-01-01), (1, 2012-01-04))' < tbox 'TBOX((1, 2012-01-03), (2, 2012-01-05))' -- true
Is the first bounding box greater than the second one?
{tbox, stbox} > {tbox, stbox}: boolean
SELECT tbox 'TBOX((1, 2012-01-03), (1, 2012-01-04))' > tbox 'TBOX((1, 2012-01-01), (2, 2012-01-05))' -- true
Is the first bounding box less than or equal to the second one?
{tbox, stbox} <= {tbox, stbox}: boolean
SELECT tbox 'TBOX((1, 2012-01-01), (1, 2012-01-04))' <= tbox 'TBOX((2, 2012-01-03), (2, 2012-01-05))' -- true
Is the first bounding box greater than or equal to the second one?
{tbox, stbox} >= {tbox, stbox}: boolean
SELECT tbox 'TBOX((1, 2012-01-01), (1, 2012-01-04))' >= tbox 'TBOX((2, 2012-01-03), (2, 2012-01-05))' -- false