Bug #89965 Need Validation when we insert data to the column with SRID
Submitted: 8 Mar 2018 14:07 Modified: 2 Oct 2020 12:48
Reporter: Shinya Sugiyama Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: gis, srid

[8 Mar 2018 14:07] Shinya Sugiyama
Description:
If it is possible it nice to have "insert validation" when we insert the Lat and Long data to the column with SRID.

How to repeat:
Example: 

1) Sample table
root@localhost [GIS]> CREATE TABLE geom (
    ->     p POINT NOT NULL SRID 0,
    ->     g GEOMETRY NOT NULL SRID 4326,
    ->     GeoHash5 varchar(5) GENERATED ALWAYS AS (st_geohash(`g`,5)) VIRTUAL,
    ->     GeoHash8 varchar(8) GENERATED ALWAYS AS (st_geohash(`g`,8)) VIRTUAL
    -> );

2) Insert the data order with latitude-longitude to the column p.

root@localhost [GIS]> INSERT INTO geom(p,g) VALUES(ST_GeomFromText('POINT(35.671482 139.718695)'),ST_GeomFromText('POINT(35.671482 139.718695)',4326));
Query OK, 1 row affected (0.00 sec)

root@localhost [GIS]> select st_geohash(p,5),st_geohash(g,5),GeoHash5,GeoHash8 from geom;
ERROR 1690 (22003): latitude value is out of range in 'st_geohash'

3) Insert the data order with longitude-latitude to the column p.
   It is working fine without error.

root@localhost [GIS]> INSERT INTO geom(p,g) VALUES(ST_GeomFromText('POINT(139.718695 35.671482)'),ST_GeomFromText('POINT(35.671482 139.718695)',4326));
Query OK, 1 row affected (0.00 sec)

root@localhost [GIS]> select st_geohash(p,5),st_geohash(g,5),GeoHash5,GeoHash8 from geom;
+-----------------+-----------------+----------+----------+
| st_geohash(p,5) | st_geohash(g,5) | GeoHash5 | GeoHash8 |
+-----------------+-----------------+----------+----------+
| xn76g           | xn76g           | xn76g    | xn76gmu1 |
+-----------------+-----------------+----------+----------+
1 row in set (0.00 sec)

root@localhost [GIS]>
[2 Oct 2020 12:48] MySQL Verification Team
Hi Mr. Sugiyama,

Thank you for your bug report.

However, what you ask for is already implemented in the latest 8.0.