If we use a geospatial function e.g. ST_Intersects on a field which has spatial index the original POINT type will automatically be changed to GEOMETRY. This could cause problems in applications where this field is expected to be POINT.
We can reproduce the bug with the following script:
DROP TABLE IF EXISTS test;
|
|
CREATE TABLE test (
|
coordinate point NOT NULL,
|
SPATIAL KEY coordinate (coordinate)
|
) ENGINE=Aria DEFAULT CHARSET=ascii PAGE_CHECKSUM=1;
|
|
SHOW COLUMNS FROM test;
|
|
INSERT INTO test (coordinate) VALUES(ST_PointFromText("POINT(0 0)"));
|
INSERT INTO test (coordinate) VALUES(ST_PointFromText("POINT(10 0)"));
|
INSERT INTO test (coordinate) VALUES(ST_PointFromText("POINT(10 10)"));
|
INSERT INTO test (coordinate) VALUES(ST_PointFromText("POINT(0 10)"));
|
INSERT INTO test (coordinate) VALUES(ST_PointFromText("POINT(5 5)"));
|
|
SELECT * FROM test WHERE ST_Intersects(ST_LineFromText("LINESTRING(0 0, 10 0, 10 10, 0 10)"), coordinate);
|
|
SHOW COLUMNS FROM test;
|
|
DROP TABLE test;
|