An operation relating two spatial values reads only the dimensions both of them have. Two values with Z are read in 3D. If one of them has no Z, both are read in 2D, the Z of the other one is ignored, and neither an error nor a notice is raised. The order of the operands does not change the answer.
-- A car with no Z and a plane above it are at the distance of the map SELECT tgeompoint '[Point(0 0)@2001-01-01, Point(10 0)@2001-01-02]' |=| tgeompoint '[Point(0 0 10000)@2001-01-01, Point(10 0 10000)@2001-01-02]'; -- 0 -- Two values with Z are read in 3D SELECT tgeompoint '[Point(0 0 0)@2001-01-01, Point(10 0 0)@2001-01-02]' |=| tgeompoint '[Point(0 0 10000)@2001-01-01, Point(10 0 10000)@2001-01-02]'; -- 10000 -- An operation building a value requires the same dimensions SELECT merge(tgeompoint 'Point(0 0)@2001-01-01', tgeompoint 'Point(0 0 0)@2001-01-02'); -- ERROR: The arguments must be of the same dimensionality -- Two reference systems are not comparable SELECT tgeompoint 'SRID=3857;Point(0 0)@2001-01-01' |=| tgeompoint 'SRID=4326;Point(0 0)@2001-01-01'; -- ERROR: Operation on mixed SRID
The rule covers the distances (|=|, <->, nearestApproachInstant, shortestLine, distance, maxDistance, and the similarity distances), the distance within (eDwithin, aDwithin, tDwithin), the relationships intersects and disjoint in their ever, always, and temporal forms, and the bounding box operators. The nearest approach instant keeps the Z of the value it is taken from, and the shortest line of operands of different dimensions has no Z.
An operation building or comparing values requires the same dimensions and raises an error otherwise. This is the case of equality and comparison, merge and the constructors, the restriction to a value, the aggregates, the union and the intersection of boxes, and the tiles.
An operation with no definition in 3D, such as contains, covers, or touches, raises an error on any operand with Z.
A type with two dimensions, such as a temporal circular buffer or a temporal rigid geometry, reads the X and Y of a 3D operand of its distances. Its other relationships raise an error on an operand with Z.
A geography is measured on the surface of the earth: its Z is not read, whether or not the other operand has one.
Values in two spatial reference systems always raise an error, since their units are not comparable.
Since the rule raises no error, a value that lacks its Z by mistake answers in 2D with no warning. The functions ??? state the dimensions to read. A column declared with a Z dimension, such as tgeompoint(Sequence, PointZ), accepts no value with no Z, so that a table cannot hold one.