Current Path : /home/usr.opt/mysql57/mysql-test/suite/gis/r/ |
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/r/spatial_indexing.result |
#Creating the spatial Geometry object USE test; DROP TABLE IF EXISTS gis_point_with_spatial_index; CREATE TABLE gis_point_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT NOT NULL,spatial index (g) ) engine=myisam; select count(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%"; count(g) 0 select ST_AsText(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%"; ST_AsText(g) DROP TABLE IF EXISTS gis_point_with_spatial_index; DROP TABLE IF EXISTS gis_line_with_spatial_index; CREATE TABLE gis_line_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING NOT NULL, spatial index (g) ) engine=myisam; select count(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%"; count(g) 0 select ST_AsText(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%"; ST_AsText(g) DROP TABLE IF EXISTS gis_line_with_spatial_index; DROP TABLE IF EXISTS gis_polygon_with_spatial_index; CREATE TABLE gis_polygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON NOT NULL, spatial index (g) ) engine=myisam; select count(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%"; count(g) 0 select ST_AsText(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%"; ST_AsText(g) DROP TABLE IF EXISTS gis_polygon_with_spatial_index; DROP TABLE IF EXISTS gis_multipoint_with_spatial_index; CREATE TABLE gis_multipoint_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT NOT NULL, spatial index (g) ) engine=myisam; select count(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%"; count(g) 0 select ST_AsText(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%"; ST_AsText(g) DROP TABLE IF EXISTS gis_multipoint_with_spatial_index; DROP TABLE IF EXISTS gis_multiline_with_spatial_index; CREATE TABLE gis_multiline_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING NOT NULL, spatial index (g) ) engine=myisam; select count(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%"; count(g) 0 select ST_AsText(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%"; ST_AsText(g) DROP TABLE IF EXISTS gis_multiline_with_spatial_index; DROP TABLE IF EXISTS gis_multipolygon_with_spatial_index; CREATE TABLE gis_multipolygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON NOT NULL, spatial index (g) ) engine=myisam; select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%"; count(g) 0 select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%"; ST_AsText(g) select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%"; count(g) 0 select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%"; ST_AsText(g) DROP TABLE IF EXISTS gis_multipolygon_with_spatial_index; DROP TABLE IF EXISTS gis_geometrycollection_with_spatial_index; CREATE TABLE gis_geometrycollection_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION NOT NULL, spatial index (g) ) engine=myisam; select count(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%"; count(g) 0 select ST_AsText(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%"; ST_AsText(g) DROP TABLE IF EXISTS gis_geometrycollection_with_spatial_index; DROP TABLE IF EXISTS gis_geometry_with_spatial_index; CREATE TABLE gis_geometry_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY NOT NULL, spatial index (g) ) engine=myisam; select count(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%"; count(g) 0 select ST_AsText(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%"; ST_AsText(g) DROP TABLE IF EXISTS gis_geometry_with_spatial_index; DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index; CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING NOT NULL,spatial index (g) ) engine=myisam; select count(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%"; count(g) 0 select ST_AsText(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%"; ST_AsText(g) DROP TABLE IF EXISTS gis_point_and_int_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; #INSERT valid entries to Point class 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); SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; COUNT(g) 4 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); SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; COUNT(g) 4 ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX g; CREATE INDEX a ON gis_point_and_int_with_spatial_index (a) ; select count(g) from gis_point_and_int_with_spatial_index where a like "%3%"; count(g) 2 select ST_AsText(g) from gis_point_and_int_with_spatial_index where a like "%3%"; ST_AsText(g) POINT(100 20) POINT(100 20) DROP TABLE IF EXISTS gis_point_and_int_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; #INSERT valid entries to Point class 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); select count(g) from gis_point_and_int_with_spatial_index where a like "%3%"; count(g) 2 SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE a LIKE "%3%"; COUNT(a) 2 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); SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; COUNT(g) 4 SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%"; COUNT(a) 4 DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index ; DROP TABLE IF EXISTS gis_linestring_and_int_with_spatial_index ; 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; #INSERT valid entries to Point class 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); select count(g) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%"; count(g) 3 select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%"; count(a) 3 select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%10 10%"; count(a) 0 ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX g; CREATE INDEX a ON gis_linestring_and_int_with_spatial_index (a) ; SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE a LIKE "%2%"; COUNT(g) 2 ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX a; CREATE SPATIAL INDEX g ON gis_linestring_and_int_with_spatial_index (g) ; SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%2%"; COUNT(g) 2 DROP TABLE IF EXISTS gis_linestring_and_int_with_spatial_index ; DROP TABLE IF EXISTS gis_multilinestring_and_int_with_spatial_index ; CREATE TABLE gis_multilinestring_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTILINESTRING NOT NULL, a int, spatial index (g) ) engine=myisam; #INSERT valid entries to Point class 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); select count(g) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%"; count(g) 3 select count(a) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%"; count(a) 3 ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX g; CREATE INDEX a ON gis_multilinestring_and_int_with_spatial_index (a) ; SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE a LIKE "%2%"; COUNT(g) 0 ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX a; CREATE SPATIAL INDEX g ON gis_multilinestring_and_int_with_spatial_index (g) ; SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%"; COUNT(g) 3 DROP TABLE IF EXISTS gis_multilinestring_and_int_with_spatial_index ; DROP TABLE IF EXISTS gis_polygon_and_int_with_spatial_index ; CREATE TABLE gis_polygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g POLYGON NOT NULL, a int, spatial index (g) ) engine=myisam; #INSERT valid entries to Point class 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); select count(g) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%"; count(g) 2 select count(a) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%"; count(a) 2 ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX g; CREATE INDEX a ON gis_polygon_and_int_with_spatial_index (a) ; SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE a LIKE "%2%"; COUNT(g) 4 ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX a; CREATE SPATIAL INDEX g ON gis_polygon_and_int_with_spatial_index (g) ; SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%"; COUNT(g) 0 DROP TABLE IF EXISTS gis_polygon_and_int_with_spatial_index ; DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index ; CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g multiPOLYGON NOT NULL, a int, spatial index (g) ) engine=myisam; #INSERT valid entries to Point class 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); select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; count(g) 3 select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; count(a) 3 ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g; CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ; SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%"; COUNT(g) 4 ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a; CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ; SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%"; COUNT(g) 4 DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index ; CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON PRIMARY KEY, a int) engine=myisam; ERROR 42000: BLOB/TEXT column 'g' used in key specification without a key length CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, unique index (g) ) engine=myisam; ERROR 42000: BLOB/TEXT column 'g' used in key specification without a key length CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, spatial index (g) ) engine=myisam; ERROR 42000: All parts of a SPATIAL index must be NOT NULL CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, spatial index (fid) ) engine=myisam; ERROR 42000: A SPATIAL index may only contain a geometrical type column CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTIPOLYGON NOT NULL, a int, spatial index (g) ) engine=myisam; #INSERT valid entries to Point class 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); select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; count(g) 3 select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%"; count(a) 3 ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g; CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ; SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%"; COUNT(g) 4 ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a; CREATE INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ; ERROR 42000: BLOB/TEXT column 'g' used in key specification without a key length CREATE SPATIAL INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ; ERROR 42000: A SPATIAL index may only contain a geometrical type column CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ; SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%"; COUNT(g) 4 DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index ;