WL#10439: Support SRID in InnoDB Spatial Index

Affects: Server-8.0   —   Status: Complete

This WL adds SRID support to InnoDB R-tree indexes.

Currently, InnoDB R-trees are not restricted to one spatial reference system
(SRS), even though it doesn't make sense to compare geometries in different
SRSs. Until 8.0, MySQL only supported Cartesian SRSs, so the computations were
the same, but in 8.0 there is geography support which requires different
formulas for comparing geometries. Therefore, the index must know which SRS it
is in in order to work correctly.

The SRID shall be obtained from the column definition and never be
changed during the lifetime of the column (note the SRID is a column property
than an index property). The SRID constraint in the column
definition could be NULL, in which case any SRID is allowed. If the SRID is not
NULL, any insertion that does not match the SRID will be rejected.

For geometry columns, SRID NULL is a valid value. It means that an SRID was not
specified in the column definition and that geometries of any SRS may be stored
in the column. It does not make sense to have an index of mixed SRSs. However,
for backwards compatibility, it is allowed to create (and maintain) indexes for
such columns. The index should emulate SRID 0 behavior. The optimizer will never
use such indexes.

The consistency of SRID across a column and rejecting incorrect SRID data must be implemented so we assume all column has the same SRID.

This WL:

 - Fetches the SRID from the column definition, and cache it in InnoDB index
metadata struct (dict_index_t) and passes it on in calls bounding box functions
declared in rtree_support.h, thereby enabling geographical indexes.

 - When create index, InnoDB will do a sanity check that SRID for all rows are
of the same type as specified by column. However, it is only a sanity check. The
rejection of insert/updates of mixed SRID must be implemented.

 - Enables geographic computations in Item_func_spatial_realation::val_int.