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 box types. These operators compare first the timestamps and if those are equal, compare the values.
Traditional comparisons
box {=, <>, <, <=, >=} box → boolean
SELECT tbox 'TBOXINT XT([1,1],[2001-01-01,2001-01-04])' = tbox 'TBOXINT XT([2,2],[2001-01-03,2001-01-05])'; -- false SELECT tbox 'TBOXFLOAT XT([1,1],[2001-01-01,2001-01-04])' <> tbox 'TBOXFLOAT XT([2,2],[2001-01-03,2001-01-05])'; -- true SELECT tbox 'TBOXINT XT([1,1],[2001-01-01,2001-01-04])' < tbox 'TBOXINT XT([1,2],[2001-01-03,2001-01-05])'; -- true SELECT tbox 'TBOXFLOAT XT([1,1],[2001-01-03,2001-01-04])' > tbox 'TBOXFLOAT XT((1,2),[2001-01-01,2001-01-05])'; -- true SELECT tbox 'TBOXINT XT([1,1],[2001-01-01,2001-01-04])' <= tbox 'TBOXINT XT([2,2],[2001-01-03,2001-01-05])'; -- true SELECT tbox 'TBOXFLOAT XT([1,1],[2001-01-01,2001-01-04])' >= tbox 'TBOXFLOAT XT([2,2],[2001-01-03,2001-01-05])'; -- false