Current Path : /home/usr.opt/mysql57/mysql-test/suite/gis/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : /home/usr.opt/mysql57/mysql-test/suite/gis/t/spatial_indexing.test |
--source include/have_geometry.inc ############################################################################################ # Creating the spatial objects # ############################################################################################ let $count=100; --echo #Creating the spatial Geometry object USE test; ############################################################################################ # POINT: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_point_with_spatial_index; --enable_warnings CREATE TABLE gis_point_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT NOT NULL,spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_point_with_spatial_index VALUES ($i,ST_PointFromText('POINT(100 10)')) dec $i; } select count(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%"; select ST_AsText(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%"; --disable_warnings DROP TABLE IF EXISTS gis_point_with_spatial_index; --enable_warnings ############################################################################################ # LINESTRING: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_line_with_spatial_index; --enable_warnings CREATE TABLE gis_line_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING NOT NULL, spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_line_with_spatial_index VALUES ($i,ST_LineStringFromText('LINESTRING(100 10,10 100)')) dec $i; } select count(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%"; select ST_AsText(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%"; --disable_warnings DROP TABLE IF EXISTS gis_line_with_spatial_index; --enable_warnings ############################################################################################ # POLYGON: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_polygon_with_spatial_index; --enable_warnings CREATE TABLE gis_polygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON NOT NULL, spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_polygon_with_spatial_index VALUES ($i,ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')) dec $i; } select count(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%"; select ST_AsText(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%"; --disable_warnings DROP TABLE IF EXISTS gis_polygon_with_spatial_index; --enable_warnings ############################################################################################ # MULTIPOINT: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_multipoint_with_spatial_index; --enable_warnings CREATE TABLE gis_multipoint_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT NOT NULL, spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_multipoint_with_spatial_index VALUES ($i,ST_MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')) dec $i; } select count(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%"; select ST_AsText(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%"; --disable_warnings DROP TABLE IF EXISTS gis_multipoint_with_spatial_index; --enable_warnings ############################################################################################ # MULTILINE: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_multiline_with_spatial_index; --enable_warnings CREATE TABLE gis_multiline_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING NOT NULL, spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_multiline_with_spatial_index VALUES ($i,ST_MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')) dec $i; } select count(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%"; select ST_AsText(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%"; --disable_warnings DROP TABLE IF EXISTS gis_multiline_with_spatial_index; --enable_warnings ############################################################################################ # MULTIPOLYGON: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_multipolygon_with_spatial_index; --enable_warnings CREATE TABLE gis_multipolygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON NOT NULL, spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_multipolygon_with_spatial_index VALUES ($i,ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')) dec $i; } select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%"; select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%"; select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%"; select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%"; --disable_warnings DROP TABLE IF EXISTS gis_multipolygon_with_spatial_index; --enable_warnings ############################################################################################ # GEOMETRY COLLECTION: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_geometrycollection_with_spatial_index; --enable_warnings CREATE TABLE gis_geometrycollection_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION NOT NULL, spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_geometrycollection_with_spatial_index VALUES ($i,ST_GeometryCollectionFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))')) dec $i; } select count(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%"; select ST_AsText(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%"; --disable_warnings DROP TABLE IF EXISTS gis_geometrycollection_with_spatial_index; --enable_warnings ############################################################################################ # GEOMETRY COLLECTION: Check indexes for spatial data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_geometry_with_spatial_index; --enable_warnings CREATE TABLE gis_geometry_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY NOT NULL, spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_geometry_with_spatial_index VALUES ($i,ST_GeometryCollectionFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))')) dec $i; } select count(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%"; select ST_AsText(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%"; --disable_warnings DROP TABLE IF EXISTS gis_geometry_with_spatial_index; --enable_warnings ############################################################################################ # Check indexes for spatial data and normal data on same table with spatial index ############################################################################################ #Create some data for point table --disable_warnings DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index; --enable_warnings CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING NOT NULL,spatial index (g) ) engine=myisam; let $i=$k; while ($i) { --eval INSERT INTO gis_point_and_int_with_spatial_index VALUES ($i,ST_PointFromText('POINT(100 10)')) dec $i; } select count(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%"; select ST_AsText(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%"; --disable_warnings DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index; --enable_warnings ############################################################################################ # Check indexes for spatial data and normal data on same table with spatial index ############################################################################################ CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT NOT NULL, a int, spatial index (g) ) engine=myisam; # Inserting the values specific to the spatial objects # --echo #INSERT valid entries to Point class --disable_warnings INSERT INTO gis_point_and_int_with_spatial_index VALUES (101, ST_PointFromText('POINT(10 10)'),1), (102, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(10 20)'))),21), (103, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(100 20)'))),3), (104, ST_GeomFromWKB(ST_AsWKB(ST_PointFromText('POINT(100 20)'))),3); #check the index was created properly SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; #the count should be 4 #drop the index ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX g; CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (g); #check the index was created properly SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; #the count should be 4 #drop the spatial index ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX g; #create index on non-indexed non-spatial data CREATE INDEX a ON gis_point_and_int_with_spatial_index (a) ; #check for data consistency select count(g) from gis_point_and_int_with_spatial_index where a like "%3%"; select ST_AsText(g) from gis_point_and_int_with_spatial_index where a like "%3%"; --disable_warnings DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index; --enable_warnings ############################################################################################ #POINT: Check indexes for spatial data and normal data on same table with spatial index ############################################################################################ CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT NOT NULL, a int, index (a) ) engine=myisam; # Inserting the values specific to the spatial objects # --echo #INSERT valid entries to Point class --disable_warnings INSERT INTO gis_point_and_int_with_spatial_index VALUES (101, ST_PointFromText('POINT(10 10)'),1), (102, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(10 20)'))),21), (103, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(100 20)'))),3), (104, ST_GeomFromWKB(ST_AsWKB(ST_PointFromText('POINT(101 20)'))),3); #check the index was created properly select count(g) from gis_point_and_int_with_spatial_index where a like "%3%"; #the count should be 2 SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE a LIKE "%3%"; #the count should be 2 #drop the non spatial index and recreate the spatial index ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX a; CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (g); #check the index was created properly SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; #the count should be 2 SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; #the count should be 2 #create a spatial index on a non existing column #CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (b); --disable_warnings DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index ; --enable_warnings ############################################################################################ #LINESTRING: Check indexes for spatial data and normal data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_linestring_and_int_with_spatial_index ; --enable_warnings CREATE TABLE gis_linestring_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING NOT NULL, a int, spatial index (g) ) engine=myisam; # Inserting the values specific to the spatial objects # --echo #INSERT valid entries to Point class --disable_warnings INSERT INTO gis_linestring_and_int_with_spatial_index VALUES (201,ST_LineFromText('LINESTRING(0 0,0 10,10 0)'),1), (202,ST_LineFromText('LINESTRING(1 1,1 10,10 20)'),2), (203,ST_LineFromText('LINESTRING(1 1,1 10,10 20)'),2); #(204, LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10)))),4); #check the index was created properly select count(g) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%"; select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%"; select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%10 10%"; #drop the spatial index ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX g; #create index on non-indexed non-spatial data CREATE INDEX a ON gis_linestring_and_int_with_spatial_index (a) ; #check the index created on a SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE a LIKE "%2%"; #drop the index ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX a; #create index on non-indexed spatial data CREATE SPATIAL INDEX g ON gis_linestring_and_int_with_spatial_index (g) ; #check the index created on a SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%2%"; --disable_warnings DROP TABLE IF EXISTS gis_linestring_and_int_with_spatial_index ; --enable_warnings ############################################################################################ #MULTILINE: Check indexes for spatial data and normal data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_multilinestring_and_int_with_spatial_index ; --enable_warnings CREATE TABLE gis_multilinestring_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTILINESTRING NOT NULL, a int, spatial index (g) ) engine=myisam; # Inserting the values specific to the spatial objects # --echo #INSERT valid entries to Point class --disable_warnings INSERT INTO gis_multilinestring_and_int_with_spatial_index VALUES (300,ST_MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'),1), (301,ST_MultiLineStringFromText('MULTILINESTRING((130 48,180 21,10 90),(916 0,516 2373223,816 48))'),1), (302,ST_MultiLineStringFromText('MULTILINESTRING((180 48,10 25891,160 0),(5416 0,19096 29093,19096 498))'),1); #(204, LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10)))),4); #check the index was created properly select count(g) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%"; select count(a) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%"; #drop the spatial index ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX g; #create index on non-indexed non-spatial data CREATE INDEX a ON gis_multilinestring_and_int_with_spatial_index (a) ; #check the index created on a SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE a LIKE "%2%"; #drop the index ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX a; #create index on non-indexed spatial data CREATE SPATIAL INDEX g ON gis_multilinestring_and_int_with_spatial_index (g) ; #check the index created on a SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%"; --disable_warnings DROP TABLE IF EXISTS gis_multilinestring_and_int_with_spatial_index ; --enable_warnings ############################################################################################ #POLYGON: Check indexes for spatial data and normal data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_polygon_and_int_with_spatial_index ; --enable_warnings CREATE TABLE gis_polygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g POLYGON NOT NULL, a int, spatial index (g) ) engine=myisam; # Inserting the values specific to the spatial objects # --echo #INSERT valid entries to Point class --disable_warnings INSERT INTO gis_polygon_and_int_with_spatial_index VALUES (300,ST_PolygonFromText('POLYGON((183670 10,2470 10,20 249380,10 254760,183670 10))'),12), (301,ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))'),2), (302,ST_PolygonFromText('POLYGON((110 10,320 310,2550 8520,1059 2590,110 10))'),2), (303,ST_PolygonFromText('POLYGON((180 160,55620 5610,240 206560,10 285960,180 160))'),2); #(204, LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10)))),4); #check the index was created properly select count(g) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%"; select count(a) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%"; #drop the spatial index ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX g; #create index on non-indexed non-spatial data CREATE INDEX a ON gis_polygon_and_int_with_spatial_index (a) ; #check the index created on a SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE a LIKE "%2%"; #drop the index ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX a; #create index on non-indexed spatial data CREATE SPATIAL INDEX g ON gis_polygon_and_int_with_spatial_index (g) ; #check the index created on a SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%"; --disable_warnings DROP TABLE IF EXISTS gis_polygon_and_int_with_spatial_index ; --enable_warnings ############################################################################################ #MULTIPOLYGON: Check indexes for spatial data and normal data on same table with spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index ; --enable_warnings CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g multiPOLYGON NOT NULL, a int, spatial index (g) ) engine=myisam; # Inserting the values specific to the spatial objects # --echo #INSERT valid entries to Point class --disable_warnings INSERT INTO gis_multipolygon_and_int_with_spatial_index VALUES (1,ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1), (2,ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,864 0,8984 42,28 26),(2 18,66 348345723,73 9,48 6,2 18)),((519 18,67 18,348345767 13,59 13,519 18)))'),1), (5,ST_MultiPolygonFromText('MULTIPOLYGON(((254397348 26,28 0,84 0,84 42,254397348 26),(52 18,634834576 23,73 9,48 34834576,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1), (9,ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,834834574 42,28 26),(52 18,348345766 23,73 9,434834578 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1); #(204, LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10)))),4); #check the index was created properly select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; #drop the spatial index ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g; #create index on non-indexed non-spatial data CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ; #check the index created on a SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%"; #drop the index ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a; #create index on non-indexed spatial data CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ; #check the index created on a SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%"; ############################################################################################ #Some erors around spatial index ############################################################################################ --disable_warnings DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index ; --enable_warnings --error ER_BLOB_KEY_WITHOUT_LENGTH CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON PRIMARY KEY, a int) engine=myisam; --error ER_BLOB_KEY_WITHOUT_LENGTH CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, unique index (g) ) engine=myisam; --error ER_SPATIAL_CANT_HAVE_NULL CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, spatial index (g) ) engine=myisam; --error ER_SPATIAL_MUST_HAVE_GEOM_COL CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, spatial index (fid) ) engine=myisam; CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTIPOLYGON NOT NULL, a int, spatial index (g) ) engine=myisam; # Inserting the values specific to the spatial objects # --echo #INSERT valid entries to Point class --disable_warnings INSERT INTO gis_multipolygon_and_int_with_spatial_index VALUES (1,ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1), (2,ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,864 0,8984 42,28 26),(2 18,66 348345723,73 9,48 6,2 18)),((519 18,67 18,348345767 13,59 13,519 18)))'),1), (5,ST_MultiPolygonFromText('MULTIPOLYGON(((254397348 26,28 0,84 0,84 42,254397348 26),(52 18,634834576 23,73 9,48 34834576,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1), (9,ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,834834574 42,28 26),(52 18,348345766 23,73 9,434834578 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1); #(204, LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10)))),4); #check the index was created properly select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; #drop the spatial index ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g; #create index on non-indexed non-spatial data CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ; #check the index created on a SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%"; #drop the index ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a; #create index on non-indexed spatial data --error ER_BLOB_KEY_WITHOUT_LENGTH CREATE INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ; #create index on non-indexed spatial data --error ER_SPATIAL_MUST_HAVE_GEOM_COL CREATE SPATIAL INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ; #create index on non-indexed spatial data CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ; #check the index created on a SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%"; --disable_warnings DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index ;