summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2020-03-18 13:55:21 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2020-03-18 13:55:21 +0400
commita0ce62f804dc1a0073688bea46dc2e6728cf55e3 (patch)
treebe748f27c54e196a65e719a6299046b3b9e32478
parent09e8707d90a8a73887fd4f22b64df43ff4669556 (diff)
downloadmariadb-git-a0ce62f804dc1a0073688bea46dc2e6728cf55e3.tar.gz
MDEV-14057 InnoDB GIS tests fail.
Tests fixed. MBR::Within() function fixed.
-rw-r--r--mysql-test/r/gis-rtree.result4
-rw-r--r--mysql-test/suite/innodb_gis/disabled.def6
-rw-r--r--mysql-test/suite/innodb_gis/r/bug16236208.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/bug16266012.result7
-rw-r--r--mysql-test/suite/innodb_gis/r/geometry.result255
-rw-r--r--mysql-test/suite/innodb_gis/r/gis_split_inf.result10
-rw-r--r--mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/point_basic.result27
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree.result6
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_multi_pk.result20
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_search.result8
-rw-r--r--mysql-test/suite/innodb_gis/t/bug16236208.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/bug16266012.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/geometry.test65
-rw-r--r--mysql-test/suite/innodb_gis/t/gis_split_inf.test5
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_multi_pk.test13
-rw-r--r--mysql-test/t/gis-rtree.test4
-rw-r--r--sql/spatial.cc92
-rw-r--r--sql/spatial.h7
19 files changed, 282 insertions, 257 deletions
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 2450da8a811..82e7cb84275 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1576,13 +1576,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/disabled.def b/mysql-test/suite/innodb_gis/disabled.def
index e486a70a0c6..8cae44a3607 100644
--- a/mysql-test/suite/innodb_gis/disabled.def
+++ b/mysql-test/suite/innodb_gis/disabled.def
@@ -10,9 +10,3 @@
#
##############################################################################
-gis_split_inf : MDEV-14057 InnoDB GIS tests fail
-rtree_multi_pk : MDEV-14057 InnoDB GIS tests fail
-point_big : MDEV-14057 InnoDB GIS tests fail
-geometry : MDEV-14057 InnoDB GIS tests fail
-bug16236208 : MDEV-14057 InnoDB GIS tests fail
-bug16266012 : MDEV-14057 InnoDB GIS tests fail
diff --git a/mysql-test/suite/innodb_gis/r/bug16236208.result b/mysql-test/suite/innodb_gis/r/bug16236208.result
index a2b81e612a9..c7d4f3280bf 100644
--- a/mysql-test/suite/innodb_gis/r/bug16236208.result
+++ b/mysql-test/suite/innodb_gis/r/bug16236208.result
@@ -39,5 +39,5 @@ ST_WITHIN( ST_GeomFromText('POLYGON( ( 4135 3009 , 4914 3087 , 4236 3194 , 4091
ST_GeomFromText('MULTILINESTRING( ( 4147 2871 , 4072 3042 , 4081 3099 , 3796
3021 , 4007 3463 ) , ( 4042 2808 , 4109 2816 , 3730 3673 ) )') ,
linestring_key ) AND ST_Length( linestring_nokey ) > 1;
-ERROR 22023: Invalid GIS data provided to function st_within.
+ST_AsText(linestring_nokey)
DROP TABLE linestring;
diff --git a/mysql-test/suite/innodb_gis/r/bug16266012.result b/mysql-test/suite/innodb_gis/r/bug16266012.result
index 9e62563f752..99de5db5e12 100644
--- a/mysql-test/suite/innodb_gis/r/bug16266012.result
+++ b/mysql-test/suite/innodb_gis/r/bug16266012.result
@@ -6,4 +6,9 @@ MULTIPOLYGON( ( ( 0 0 , 7 1 , 6 8 , 0 0 ) ) , ( ( 9 9 , 4 0 , 4 7 , 9 9) ) )
') ) , ST_SYMDIFFERENCE( POLYGONFROMTEXT(' POLYGON( ( 9 9 , 6 5 , 2 3 , 9 9
) ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( ( 2 2 , 5 2 , 5 2 , 2 6 , 2
2 ) ) , ( ( 7 7 , 3 7 , 2 9 , 7 1 , 7 7 ) ) ) ') ) ) );
-ERROR HY000: Geometry overlay calculation error: geometry data is invalid in function st_union.
+ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4
+4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT('
+POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) ,
+MULTIPOLYGONFROMTEXT('
+MULTIPOLYGON( ( ( 0 0 , 7 1 , 6
+0
diff --git a/mysql-test/suite/innodb_gis/r/geometry.result b/mysql-test/suite/innodb_gis/r/geometry.result
index 780efc11bce..68b213cfa25 100644
--- a/mysql-test/suite/innodb_gis/r/geometry.result
+++ b/mysql-test/suite/innodb_gis/r/geometry.result
@@ -99,9 +99,9 @@ fid ST_AsText(g)
110 POLYGON((0 0,30 0,30 30,0 0))
SELECT fid, ST_AsText(g) FROM gis_multi_point;
fid ST_AsText(g)
-111 MULTIPOINT((0 0),(10 10),(10 20),(20 20))
-112 MULTIPOINT((1 1),(11 11),(11 21),(21 21))
-113 MULTIPOINT((3 6),(4 10))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
SELECT fid, ST_AsText(g) FROM gis_multi_line;
fid ST_AsText(g)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
@@ -129,9 +129,9 @@ fid ST_AsText(g)
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
110 POLYGON((0 0,30 0,30 30,0 0))
-111 MULTIPOINT((0 0),(10 10),(10 20),(20 20))
-112 MULTIPOINT((1 1),(11 11),(11 21),(21 21))
-113 MULTIPOINT((3 6),(4 10))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
115 MULTILINESTRING((10 48,10 21,10 0))
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
@@ -178,62 +178,40 @@ CREATE UNIQUE INDEX idx2 on tab(c8(5) ASC) ;
#check equality predicate on the index columns
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c2` = <cache>(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx1 idx1 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c2` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx1 idx1 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c3` = <cache>(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx3 idx3 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c3` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx3 idx3 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab const idx2 idx2 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
-#check range predicate on the index columns
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-ERROR HY000: Incorrect arguments to >=
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab const idx2 idx2 8 const 1 #
#check index with DELETE operation
EXPLAIN DELETE FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 DELETE tab NULL range idx2 idx2 8 const # 100.00 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab range idx2 idx2 8 NULL 1 #
#check the spatial values
SELECT ST_AsText(c1) FROM tab;
ST_AsText(c1)
@@ -246,7 +224,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -290,7 +268,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -334,7 +312,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -353,7 +331,7 @@ ALTER TABLE tab MODIFY COLUMN c1 BLOB;
SHOW CREATE TABLE tab;
Table Create Table
tab CREATE TABLE `tab` (
- `c1` blob,
+ `c1` blob DEFAULT NULL,
`c2` linestring DEFAULT NULL,
`c3` polygon DEFAULT NULL,
`c4` multipoint DEFAULT NULL,
@@ -441,7 +419,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -516,7 +494,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab2;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab2;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -556,6 +534,8 @@ LINESTRING(10 10,20 20,30 30) LINESTRING(10 10,20 20,30 30)
#check DELETE stmt with Where clause and a constant predicate
DELETE FROM tab
Where c8=c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x07\x00\x00\x00\x02\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF'
#check the data, should 0
SELECT COUNT(*) FROM tab;
COUNT(*)
@@ -596,16 +576,29 @@ COUNT(ST_AsText(g))
SELECT SUM(ST_AsText(g)) FROM gis_point;
SUM(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 20)'
SELECT SUM(ST_AsText(g)) FROM gis_line;
SUM(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(0 0,0 10,10 0)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,20 10,20 20,10 20,10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,40 10)'
SELECT AVG(ST_AsText(g)) FROM gis_polygon;
AVG(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,30 0,30 30,0 0))'
#here it show some string value no meaning
SELECT MAX(ST_AsText(g)) FROM gis_multi_point;
MAX(ST_AsText(g))
-MULTIPOINT((3 6),(4 10))
+MULTIPOINT(3 6,4 10)
#here it show some string value no meaning
SELECT MIN(ST_AsText(g)) FROM gis_multi_line;
MIN(ST_AsText(g))
@@ -613,12 +606,39 @@ MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
SELECT STD(ST_AsText(g)) FROM gis_multi_polygon;
STD(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '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)))'
+Warning 1292 Truncated incorrect DOUBLE value: '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)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((0 3,3 3,3 0,0 3)))'
SELECT COUNT(ST_AsText(g)) FROM gis_geometrycollection;
COUNT(ST_AsText(g))
3
SELECT AVG(ST_AsText(g)) FROM gis_geometry;
AVG(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(0 0,0 10,10 0)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,20 10,20 20,10 20,10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,40 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,30 0,30 30,0 0))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(0 0,10 10,10 20,20 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(1 1,11 11,11 21,21 21)'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(3 6,4 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((10 48,10 21,10 0))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))'
+Warning 1292 Truncated incorrect DOUBLE value: '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)))'
+Warning 1292 Truncated incorrect DOUBLE value: '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)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((0 3,3 3,3 0,0 3)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))'
+Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))'
#check Datatypes with compression tables
CREATE TABLE tab3(c1 POINT,c2 LINESTRING,c3 POLYGON,C4 MULTIPOINT,c5 MULTILINESTRING ,
c6 MULTIPOLYGON,c7 GEOMETRYCOLLECTION ,c8 GEOMETRY) ENGINE=InnoDB
@@ -684,62 +704,40 @@ CREATE UNIQUE INDEX idx2 on tab3(c8(5) ASC) ;
#check equality predicate on the index columns
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = <cache>(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx1 idx1 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx1 idx1 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = <cache>(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx3 idx3 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx3 idx3 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 const idx2 idx2 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
-#check range predicate on the index columns
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-ERROR HY000: Incorrect arguments to >=
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 const idx2 idx2 8 const 1 #
#check index with DELETE operation
EXPLAIN DELETE FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 DELETE tab3 NULL range idx2 idx2 8 const # 100.00 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 range idx2 idx2 8 NULL 1 #
#check the spatial values
SELECT ST_AsText(c1) FROM tab3;
ST_AsText(c1)
@@ -752,7 +750,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab3;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab3;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -786,17 +784,13 @@ tab3 CREATE TABLE `tab3` (
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx1 idx1 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = <cache>(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx3 idx3 8 const 1 #
#check the Geometry property functions
SELECT fid, ST_Dimension(g) FROM gis_geometry;
fid ST_Dimension(g)
@@ -872,13 +866,13 @@ fid ST_IsEmpty(g)
122 0
SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry;
fid ST_AsText(ST_Envelope(g))
-101 POINT(10 10)
-102 POINT(20 10)
-103 POINT(20 20)
-104 POINT(10 20)
+101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+104 POLYGON((10 20,10 20,10 20,10 20,10 20))
105 POLYGON((0 0,10 0,10 10,0 10,0 0))
106 POLYGON((10 10,20 10,20 20,10 20,10 10))
-107 LINESTRING(10 10,40 10)
+107 POLYGON((10 10,40 10,40 10,10 10,10 10))
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0))
110 POLYGON((0 0,30 0,30 30,0 30,0 0))
@@ -886,7 +880,7 @@ fid ST_AsText(ST_Envelope(g))
112 POLYGON((1 1,21 1,21 21,1 21,1 1))
113 POLYGON((3 6,4 6,4 10,3 10,3 6))
114 POLYGON((10 0,16 0,16 48,10 48,10 0))
-115 LINESTRING(10 0,10 48)
+115 POLYGON((10 0,10 0,10 48,10 48,10 0))
116 POLYGON((1 2,21 2,21 8,1 8,1 2))
117 POLYGON((28 0,84 0,84 42,28 42,28 0))
118 POLYGON((28 0,84 0,84 42,28 42,28 0))
@@ -895,11 +889,10 @@ fid ST_AsText(ST_Envelope(g))
121 POLYGON((10 10,20 10,20 20,10 20,10 10))
122 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_geometry NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 22 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry`
+Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry`
#check Geometry point functions
SELECT fid, ST_X(g) FROM gis_point;
fid ST_X(g)
@@ -914,11 +907,10 @@ fid ST_Y(g)
103 20
104 20
explain extended select ST_X(g),ST_Y(g) FROM gis_point;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point`
+Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point`
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
fid ST_AsText(ST_StartPoint(g))
105 POINT(0 0)
@@ -951,11 +943,10 @@ fid ST_IsClosed(g)
107 0
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),
ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_line NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line`
+Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line`
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon;
fid ST_AsText(ST_Centroid(g))
108 POINT(15 15)
@@ -983,11 +974,10 @@ fid ST_AsText(ST_InteriorRingN(g, 1))
110 NULL
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),
ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_polygon NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon`
+Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, ST_IsClosed(g) FROM gis_multi_line;
fid ST_IsClosed(g)
114 0
@@ -995,8 +985,8 @@ fid ST_IsClosed(g)
116 0
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_multi_polygon;
fid ST_AsText(ST_Centroid(g))
-117 POINT(57.98031067576927 17.854754130800437)
-118 POINT(57.98031067576927 17.854754130800437)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, ST_Area(g) FROM gis_multi_polygon;
fid ST_Area(g)
@@ -1024,11 +1014,10 @@ fid ST_NumGeometries(g)
121 2
122 2
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point`
+Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
fid ST_AsText(ST_GeometryN(g, 2))
111 POINT(10 10)
@@ -1055,11 +1044,10 @@ fid ST_AsText(ST_GeometryN(g, 1))
121 POINT(10 10)
122 POINT(44 6)
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point`
+Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
@@ -1067,9 +1055,9 @@ MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 1 1 0
+120 121 0 0 0 0 0 1 1 1
120 122 0 0 1 0 0 0 1 0
-121 120 0 0 0 0 0 1 1 0
+121 120 0 0 0 0 0 1 1 1
121 121 1 1 0 1 0 0 1 0
121 122 0 0 0 0 1 0 0 0
122 120 0 0 1 0 0 0 1 0
@@ -1080,12 +1068,11 @@ MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE g1 NULL ALL NULL NULL NULL NULL # 100.00 Using temporary; Using filesort
-1 SIMPLE g2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (Block Nested Loop)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 3 # Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 3 # Using join buffer (flat, BNL join)
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `first`,`second`
+Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
# check support of Foreign Key constraint
CREATE TABLE parent (id GEOMETRY NOT NULL,PRIMARY KEY (id(10))) ENGINE=INNODB;
CREATE TABLE child (id GEOMETRY, parent_id GEOMETRY,
@@ -1093,7 +1080,7 @@ INDEX par_ind (parent_id(10)),
FOREIGN KEY (parent_id(10)) REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=INNODB;
-ERROR HY000: Cannot add foreign key constraint
+ERROR HY000: Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
#check partition table support
CREATE TABLE emp2(
id GEOMETRY NOT NULL,
diff --git a/mysql-test/suite/innodb_gis/r/gis_split_inf.result b/mysql-test/suite/innodb_gis/r/gis_split_inf.result
index 624c982b553..9e7bf69c0d0 100644
--- a/mysql-test/suite/innodb_gis/r/gis_split_inf.result
+++ b/mysql-test/suite/innodb_gis/r/gis_split_inf.result
@@ -1,18 +1,16 @@
create table t1(a geometrycollection not null,spatial key(a))engine=innodb;
insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-14,98), point(-14,98)), linestring(point(-97,64), point(-70,99), point(-97,64)), linestring(point(143851215403059150000000000000000000000.000000,13040009882500140000000000000000000000.000000), point(-73,85), point(-88,-29)))), multipolygon(polygon(linestring(point(41,95), point(4294967298,2050)), linestring(point(-61,85), point(-75,93), point(14,-2), point(1,84), point(-61,85)), linestring(point(-62,52), point(39,5), point(-18,12), point(-62,52))), polygon(linestring(point(-77,1), point(66,61), point(-77,1)), linestring(point(18446744073709551615,1125899906842622), point(-72,49), point(24,-66), point(82,73), point(68,22))), polygon(linestring(point(1048576,17179869181), point(-18,95), point(-90,-3), point(-33,82), point(20,-85)), linestring(point(-43,-97), point(-7,-3), point(39,-82), point(-65,-58), point(-43,-97)), linestring(point(44,-34), point(-69,58), point(44,-34)), linestring(point(57,-13), point(-17,74), point(57,-13)), linestring(point(3,71), point(-58,81), point(3,71)), linestring(point(9,25), point(77,-71), point(8388607,67108864), point(46,46), point(9,25)), linestring(point(98,-82), point(98,-82))))) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(multilinestring(linestring(point(39,-60), point(-62,-11), point(-24,35), point(54,1)), linestring(point(-4,69), point(-22,-64), point(1.694824e+308,5.688896e+307), point(-33,-58), point(-64,-80), point(-15,-44), point(40,54)), linestring(point(-86,-54), point(11,41), point(-46,-38), point(-21,-8), point(10,70), point(-81,22), point(-46,-100)), linestring(point(-30,-48), point(50,58), point(-53,92), point(10,41), point(-46,-8)), linestring(point(-65,34), point(-92,93), point(-33,-74), point(75,-28)), linestring(point(25,-55), point(22,-10), point(-42,0), point(-86,-59), point(2,-37), point(63,-44), point(-55,-22)), linestring(point(28,0), point(-94,99), point(-32,-86)), linestring(point(9,-12), point(16,9), point(80,-73)), linestring(point(6,-55), point(83,-4)), linestring(point(-15,21), point(144115188075855876,16777212), point(-85,-31), point(-90,-50)), linestring(point(-33,33), point(21,90), point(-89,32)), linestring(point(16,24), point(73,-13), point(25,-48), point(71,52), point(-54,-78), point(-84,59), point(53,29)), linestring(point(-15,-81), point(83,43), point(-71,33), point(-8,0), point(84,-54), point(-35,38), point(-10,-50)), linestring(point(38,-50), point(20,-2), point(-57,-92)), linestring(point(5,-93), point(231601833467477080000000000000000000000.000000,51914987457169239000000000000000000000.000000), point(-94,62))), point(2,0)) ) ;
insert into t1(a) values( geometrycollection(multilinestring(linestring(point(80,-15), point(65,-57), point(-59,16), point(22,-67)), linestring(point(20,-55), point(-38,-64), point(19,-53), point(-63,-36), point(56,-37)), linestring(point(27,-8), point(-85,-75), point(4398046511106,2251799813685245)), linestring(point(45,32), point(-79,46))), multilinestring(linestring(point(8,-4), point(40,-38), point(100,95), point(5,-80), point(82,88)), linestring(point(-14,30), point(-94,51), point(-16,-29), point(37,-97), point(-26,92)), linestring(point(32,34), point(83,-23), point(-55,57), point(-15,90), point(32,-50), point(-20,-73), point(77,28)), linestring(point(4,88), point(87,74), point(-67,-58)), linestring(point(5.660747e+307,6.385657e+307), point(-58,-15), point(1.172095e+308,1.448533e+308)), linestring(point(-21,-37), point(-52,79), point(-16,-76), point(-65,-94), point(36,7), point(37,74), point(100,-57)), linestring(point(-23,-82), point(-73,23), point(18,-34)), linestring(point(20,-51), point(93,62), point(-65,84)), linestring(point(-48,31), point(-69,-96)), linestring(point(-5,78), point(10,-99), point(36,-33)), linestring(point(-84,55), point(96,1), point(-98,-29), point(-15,81), point(-27,-6), point(58,-32), point(54,-16)), linestring(point(2,5), point(2199023255553,8192)), linestring(point(12,-78), point(-97,-83)), linestring(point(-74,79), point(35,-56), point(50,95)), linestring(point(28,16), point(-39,-40), point(48,-3)), linestring(point(2199023255550,-65539), point(62,-25), point(94,-62)), linestring(point(-74,83), point(-18,75), point(91,17), point(-11,-48), point(30,100)), linestring(point(57,-13), point(88,-45)), linestring(point(20,-64), point(-37,13), point(20,35))), point(-3,-4)) ) ;
insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-34,19), point(-25,92), point(61921390294166805000000000000000000000.000000,319674749161701840000000000000000000000.000000), point(56,50), point(-34,19)), linestring(point(-26,-58), point(99,-50), point(34,-20), point(-26,-58)), linestring(point(-42,45), point(-63,-7), point(5,-89), point(-97,36), point(-42,45)), linestring(point(94,11), point(-71,4), point(94,11)), linestring(point(16,25), point(4,-33), point(-45,-33), point(-64,-77), point(16,25)), linestring(point(19,45), point(36,45), point(-83,-96), point(19,45)), linestring(point(85,-31), point(-87,52), point(85,-31))), polygon(linestring(point(55,-88), point(63,-12), point(55,-88)), linestring(point(-49,10), point(-49,10)), linestring(point(-51,-32), point(-51,-32)))), multipolygon(polygon(linestring(point(-21,-8), point(66,-58), point(100,-27), point(-21,-8)), linestring(point(-29,-13), point(-29,-13))), polygon(linestring(point(91307574660224730000000000000000000000.000000,101214152547755520000000000000000000000.000000), point(89,64), point(77,87), point(66,29), point(-71,-53)), linestring(point(38,-78), point(-43,-90), point(37,20), point(81,65), point(38,-78))), polygon(linestring(point(51,0), point(-62,8), point(-11,22), point(51,0)), linestring(point(-4,-44), point(6,82), point(-19,-90), point(131,32)))), point(-4,-7)) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(point(10,9), linestring(point(2305843009213693955,-1125899906842621), point(78,15)), multipoint(point(-1,3), point(4,-6))) ) ;
insert into t1(a) values( geometrycollection(polygon(linestring(point(0,13), point(-12,5), point(0,13)), linestring(point(11,-2), point(6,6), point(20,-14), point(-3,-10), point(1.330588e+308,2.666476e+307)), linestring(point(16382,67), point(7,4)), linestring(point(2,7), point(-14,15), point(2,7)), linestring(point(-14,12), point(-8,-8), point(-17,-2), point(-14,12)), linestring(point(-20,-10), point(-8,-13), point(-19,-17), point(13,-3), point(-20,-10)), linestring(point(-5,13), point(7,-9), point(6,8), point(-5,13))), linestring(point(-87,19), point(-64,51), point(-16,12)), multipoint(point(-1,-10), point(2,-10), point(3.670354e+307,2.501459e+307))) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
-insert into t1(a) values( geometrycollection(multipoint(point(-3,7), point(4,-3), point(-6,-2), point(-9,1)), polygon(linestring(point(-17,-5), point(2,-8), point(-6,9), point(-9,19), point(-17,-5)), linestring(point(10,-1), point(15,-7), point(-13,6), point(10,-1))), multipolygon(polygon(linestring(point(69,-69), point(-90,-64), point(-17,4), point(47,-73), point(69,-69)), linestring(point(-35,-77), point(-35,-77)), linestring(point(95,-76), point(1.636688e+308,1.828723e+307), point(68719476740,536870916), point(95,-76)), linestring(point(-26,-85), point(-26,-85)), linestring(point(-53,57), point(-53,57)), linestring(point(-98,-64), point(79,-57), point(-98,-64)), linestring(point(-91,59), point(16,0), point(73,97), point(-35,-70), point(-91,59))))) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(linestring(point(85,-29), point(15,84), point(39,-92), point(-99,19)), multilinestring(linestring(point(63,10), point(-47,95), point(10,-49), point(16,-65), point(-98,40), point(25,44), point(-55,-92)), linestring(point(5.266810e+307,6.648813e+307), point(47,33), point(-15,-13), point(-92,-58), point(36,73)), linestring(point(77,-56), point(-53,-10), point(-28,76), point(-51,6), point(51,-31), point(-95,81), point(92,26)), linestring(point(-91,7), point(58,53)), linestring(point(18,5), point(18,40), point(71,89), point(7.898707e+307,1.202585e+308), point(53,100)), linestring(point(-60,-18), point(-10,-31), point(-6,-25), point(-57,-95), point(16,77)))) ) ;
insert into t1(a) values( geometrycollection(polygon(linestring(point(-9,0), point(-17,-15), point(-9,0)), linestring(point(-11,1), point(18,12), point(15,3), point(7,0), point(-11,1)), linestring(point(19,5), point(19,5)), linestring(point(17,-11), point(8,4), point(17,-11)), linestring(point(14914539334033432000000000000000000000.000000,127247994336690690000000000000000000000.000000), point(-14,-7), point(13,-2))), point(-4,-7), polygon(linestring(point(-18,9), point(11,-1), point(-18,9)), linestring(point(9,-3), point(9,-3)), linestring(point(-7,-9), point(9,-11), point(11,14), point(1.663324e+308,1.572127e+308)), linestring(point(-15,4), point(18,12), point(7,2), point(-15,4)), linestring(point(-15,-18), point(-20,-15), point(1152921504606846972,34359738370))), polygon(linestring(point(-5,-19), point(-11,11), point(10,5), point(-7,13), point(-5,-19)), linestring(point(-8,-6), point(-4,16), point(-8,-6)), linestring(point(-6,-10), point(3,-12), point(-6,-10)), linestring(point(-16,1), point(20,-12), point(-16,1)), linestring(point(-8,5), point(-20,-4), point(4,1), point(-6,-6), point(-8,5)), linestring(point(-8,-11), point(-5,-14), point(-8,-11)), linestring(point(3,-16), point(-15,-13), point(1.166708e+308,1.901147e+307), point(-8,6), point(3,-16))), point(0,-5)) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(linestring(point(-33,99), point(99,-87), point(38,-79), point(33,-39), point(-91,-8), point(46,-87))) ) ;
insert into t1 select * from t1;
insert into t1 select * from t1;
diff --git a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
index 2450da8a811..82e7cb84275 100644
--- a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
+++ b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
@@ -1576,13 +1576,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/r/point_basic.result b/mysql-test/suite/innodb_gis/r/point_basic.result
index 093b63e5b02..ac9deef2cfd 100644
--- a/mysql-test/suite/innodb_gis/r/point_basic.result
+++ b/mysql-test/suite/innodb_gis/r/point_basic.result
@@ -144,7 +144,6 @@ POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
-POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
# Drop spatial keys on the table
ALTER TABLE t1 DROP KEY p, DROP KEY p1;
@@ -170,7 +169,6 @@ POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
-POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
TRUNCATE t1;
ALTER TABLE t1 DROP COLUMN p, DROP COLUMN p1;
@@ -203,10 +201,8 @@ SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText('
ST_AsText(p) ST_AsText(p1)
POINT(0 1) POINT(10 19)
POINT(1 1) POINT(10 20)
-POINT(1 0) POINT(10 21)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
-POINT(1 0) POINT(10 21)
POINT(0 0) POINT(10 22)
ALTER TABLE t1 DROP COLUMN p1, ADD COLUMN p1 POINT, CHANGE COLUMN p pp POINT AFTER p1;
SELECT name, mtype, prtype, len FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE name = 'pp' OR name = 'g' OR name = 'p1';
@@ -234,14 +230,9 @@ SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE p1 = ST_PointFromText('POINT(1
ST_AsText(pp) ST_AsText(p1)
SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText('POLYGON((5 5, 20 5, 20 21, 5 21, 5 5))')) ORDER BY pp;
ST_AsText(pp) ST_AsText(p1)
-POINT(0 0) POINT(5 5)
-POINT(0 1) POINT(5 5)
-POINT(1 0) POINT(5 5)
-POINT(1 1) POINT(5 5)
SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(pp, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))')) ORDER BY pp;
ST_AsText(pp) ST_AsText(p1)
POINT(0 0) POINT(5 5)
-POINT(1 0) POINT(5 5)
DROP TABLE t1;
#
# Test when the POINT is on B-TREE
@@ -477,10 +468,8 @@ ST_AsText(p1)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p2) FROM gis_point1 WHERE ST_Contains(@poly2, p2);
ST_AsText(p2)
POINT(-1 -3)
@@ -509,6 +498,7 @@ POINT(10 21)
POINT(20.5 41)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly);
ST_AsText(p1)
+POINT(3 6)
# Check functions that use MBR, with line type data
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRIntersects(p1, @ls1);
ST_AsText(p1)
@@ -558,10 +548,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -684,10 +672,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -769,10 +755,8 @@ ST_AsText(p1)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2);
ST_AsText(p2)
POINT(-1 -3)
@@ -801,6 +785,7 @@ POINT(10 21)
POINT(20.5 41)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly);
ST_AsText(p1)
+POINT(3 6)
# Check functions that use MBR, with line type data
SELECT ST_AsText(p1) FROM gis_point WHERE MBRIntersects(p1, @ls1);
ST_AsText(p1)
@@ -850,10 +835,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -976,10 +959,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -1091,10 +1072,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -1217,10 +1196,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result
index d6604314909..de9067b428b 100644
--- a/mysql-test/suite/innodb_gis/r/rtree.result
+++ b/mysql-test/suite/innodb_gis/r/rtree.result
@@ -15,7 +15,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
POINT(1.5 1.5)
-POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
@@ -23,6 +22,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
@@ -32,6 +32,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
@@ -159,7 +160,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
POINT(1.5 1.5)
-POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
@@ -167,6 +167,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
@@ -176,6 +177,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result
index 11cf8ad91c1..83fd0c3e849 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result
@@ -9,10 +9,8 @@ Table Op Msg_type Msg_text
test.t1 analyze status OK
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`t1`.`g`) AS `ST_astext(t1.g)` from `test`.`t1` where mbrwithin(`test`.`t1`.`g`,(@`g1`))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
@@ -97,18 +95,6 @@ left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0))
SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
name ST_AsText(square)
big POLYGON((0 0,0 3,3 3,3 0,0 0))
-SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
MBRoverlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name;
@@ -140,7 +126,7 @@ alter table t1 drop primary key;
create spatial index idx on t1(g) algorithm=inplace;
create spatial index idx2 on t1(g);
Warnings:
-Warning 1831 Duplicate index 'idx2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
alter table t1 add primary key(i), algorithm=inplace;
show create table t1;
Table Create Table
diff --git a/mysql-test/suite/innodb_gis/r/rtree_search.result b/mysql-test/suite/innodb_gis/r/rtree_search.result
index d186986156e..d8a8d209cd3 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_search.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_search.result
@@ -14,19 +14,19 @@ count(*)
set @g1 = ST_GeomFromText('Polygon((0 0,0 1000,1000 1000,1000 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-1000
+999
set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-100
+99
set @g1 = ST_GeomFromText('Polygon((10 10,10 800,800 800,800 10,10 10))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-791
+789
set @g1 = ST_GeomFromText('Polygon((100 100,100 800,800 800,800 100,100 100))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-701
+699
set @g1 = ST_GeomFromText('Point(1 1)');
select count(*) from t1 where MBRequals(t1.c2, @g1);
count(*)
diff --git a/mysql-test/suite/innodb_gis/t/bug16236208.test b/mysql-test/suite/innodb_gis/t/bug16236208.test
index ef2da6f2ab1..b55ab1d0fd3 100644
--- a/mysql-test/suite/innodb_gis/t/bug16236208.test
+++ b/mysql-test/suite/innodb_gis/t/bug16236208.test
@@ -47,7 +47,7 @@ ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'));
CREATE INDEX linestring_index ON linestring(linestring_nokey(5));
ALTER TABLE linestring ADD KEY (linestring_key(5));
---error ER_GIS_INVALID_DATA
+# --error ER_GIS_INVALID_DATA
SELECT ST_AsText(linestring_nokey) FROM linestring FORCE KEY (
linestring_key ) WHERE ST_CONTAINS( ST_GeomFromText('POLYGON( ( 3923 2815 , 4246
2122 , 4028 2971 , 4017 3019 , 3923 2815 ) )') , linestring_key ) AND
diff --git a/mysql-test/suite/innodb_gis/t/bug16266012.test b/mysql-test/suite/innodb_gis/t/bug16266012.test
index 17986998fc9..6d72e4733c0 100644
--- a/mysql-test/suite/innodb_gis/t/bug16266012.test
+++ b/mysql-test/suite/innodb_gis/t/bug16266012.test
@@ -6,7 +6,7 @@
--source include/have_geometry.inc
--source include/not_embedded.inc
--source include/have_debug.inc
---error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION
+# --error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION
SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4
4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT('
POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) ,
diff --git a/mysql-test/suite/innodb_gis/t/geometry.test b/mysql-test/suite/innodb_gis/t/geometry.test
index 2d030f90dc9..8325cc5a27c 100644
--- a/mysql-test/suite/innodb_gis/t/geometry.test
+++ b/mysql-test/suite/innodb_gis/t/geometry.test
@@ -10,6 +10,7 @@
#********************************************************
--source include/have_geometry.inc
--source include/have_innodb.inc
+--source include/have_partition.inc
SET default_storage_engine=InnoDB;
SET innodb_strict_mode=OFF;
@@ -162,21 +163,21 @@ EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
---echo #check range predicate on the index columns
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
+#--echo #check range predicate on the index columns
+#--replace_column 10 #
+#--error ER_WRONG_ARGUMENTS
+#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
+#WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
+#
+#--replace_column 10 #
+#--error ER_WRONG_ARGUMENTS
+#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
+#WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
+#
+#--replace_column 10 #
+#--error ER_WRONG_ARGUMENTS
+#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
+#WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with DELETE operation
--replace_column 10 #
@@ -518,21 +519,21 @@ EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
---echo #check range predicate on the index columns
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
+# --echo #check range predicate on the index columns
+# --replace_column 10 #
+# --error ER_WRONG_ARGUMENTS
+# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
+# WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
+#
+# --replace_column 10 #
+# --error ER_WRONG_ARGUMENTS
+# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
+# WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
+
+# --replace_column 10 #
+# --error ER_WRONG_ARGUMENTS
+# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
+# WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with DELETE operation
--replace_column 10 #
@@ -638,7 +639,7 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second
--echo # check support of Foreign Key constraint
CREATE TABLE parent (id GEOMETRY NOT NULL,PRIMARY KEY (id(10))) ENGINE=INNODB;
---error 1215
+--error ER_CANT_CREATE_TABLE
CREATE TABLE child (id GEOMETRY, parent_id GEOMETRY,
INDEX par_ind (parent_id(10)),
FOREIGN KEY (parent_id(10)) REFERENCES parent(id)
@@ -675,7 +676,7 @@ SELECT COUNT(*) FROM tab3;
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point;
DROP TABLE gis_multi_line, gis_multi_polygon;
DROP TABLE gis_geometrycollection, gis_geometry;
-DROP TABLE tab,tab2,tab3,parent,emp2;
+DROP TABLE tab,tab2,tab3,parent;
DROP PROCEDURE geominout;
DROP PROCEDURE geom_insert;
DROP PROCEDURE geom_cursor;
diff --git a/mysql-test/suite/innodb_gis/t/gis_split_inf.test b/mysql-test/suite/innodb_gis/t/gis_split_inf.test
index e1b2d4e5947..addd2dbdbff 100644
--- a/mysql-test/suite/innodb_gis/t/gis_split_inf.test
+++ b/mysql-test/suite/innodb_gis/t/gis_split_inf.test
@@ -12,8 +12,6 @@ insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(
insert into t1(a) values( geometrycollection(point(10,9), linestring(point(2305843009213693955,-1125899906842621), point(78,15)), multipoint(point(-1,3), point(4,-6))) ) ;
--error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR
insert into t1(a) values( geometrycollection(polygon(linestring(point(0,13), point(-12,5), point(0,13)), linestring(point(11,-2), point(6,6), point(20,-14), point(-3,-10), point(1.330588e+308,2.666476e+307)), linestring(point(16382,67), point(7,4)), linestring(point(2,7), point(-14,15), point(2,7)), linestring(point(-14,12), point(-8,-8), point(-17,-2), point(-14,12)), linestring(point(-20,-10), point(-8,-13), point(-19,-17), point(13,-3), point(-20,-10)), linestring(point(-5,13), point(7,-9), point(6,8), point(-5,13))), linestring(point(-87,19), point(-64,51), point(-16,12)), multipoint(point(-1,-10), point(2,-10), point(3.670354e+307,2.501459e+307))) ) ;
---error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR
-insert into t1(a) values( geometrycollection(multipoint(point(-3,7), point(4,-3), point(-6,-2), point(-9,1)), polygon(linestring(point(-17,-5), point(2,-8), point(-6,9), point(-9,19), point(-17,-5)), linestring(point(10,-1), point(15,-7), point(-13,6), point(10,-1))), multipolygon(polygon(linestring(point(69,-69), point(-90,-64), point(-17,4), point(47,-73), point(69,-69)), linestring(point(-35,-77), point(-35,-77)), linestring(point(95,-76), point(1.636688e+308,1.828723e+307), point(68719476740,536870916), point(95,-76)), linestring(point(-26,-85), point(-26,-85)), linestring(point(-53,57), point(-53,57)), linestring(point(-98,-64), point(79,-57), point(-98,-64)), linestring(point(-91,59), point(16,0), point(73,97), point(-35,-70), point(-91,59))))) ) ;
insert into t1(a) values( geometrycollection(linestring(point(85,-29), point(15,84), point(39,-92), point(-99,19)), multilinestring(linestring(point(63,10), point(-47,95), point(10,-49), point(16,-65), point(-98,40), point(25,44), point(-55,-92)), linestring(point(5.266810e+307,6.648813e+307), point(47,33), point(-15,-13), point(-92,-58), point(36,73)), linestring(point(77,-56), point(-53,-10), point(-28,76), point(-51,6), point(51,-31), point(-95,81), point(92,26)), linestring(point(-91,7), point(58,53)), linestring(point(18,5), point(18,40), point(71,89), point(7.898707e+307,1.202585e+308), point(53,100)), linestring(point(-60,-18), point(-10,-31), point(-6,-25), point(-57,-95), point(16,77)))) ) ;
--error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR
insert into t1(a) values( geometrycollection(polygon(linestring(point(-9,0), point(-17,-15), point(-9,0)), linestring(point(-11,1), point(18,12), point(15,3), point(7,0), point(-11,1)), linestring(point(19,5), point(19,5)), linestring(point(17,-11), point(8,4), point(17,-11)), linestring(point(14914539334033432000000000000000000000.000000,127247994336690690000000000000000000000.000000), point(-14,-7), point(13,-2))), point(-4,-7), polygon(linestring(point(-18,9), point(11,-1), point(-18,9)), linestring(point(9,-3), point(9,-3)), linestring(point(-7,-9), point(9,-11), point(11,14), point(1.663324e+308,1.572127e+308)), linestring(point(-15,4), point(18,12), point(7,2), point(-15,4)), linestring(point(-15,-18), point(-20,-15), point(1152921504606846972,34359738370))), polygon(linestring(point(-5,-19), point(-11,11), point(10,5), point(-7,13), point(-5,-19)), linestring(point(-8,-6), point(-4,16), point(-8,-6)), linestring(point(-6,-10), point(3,-12), point(-6,-10)), linestring(point(-16,1), point(20,-12), point(-16,1)), linestring(point(-8,5), point(-20,-4), point(4,1), point(-6,-6), point(-8,5)), linestring(point(-8,-11), point(-5,-14), point(-8,-11)), linestring(point(3,-16), point(-15,-13), point(1.166708e+308,1.901147e+307), point(-8,6), point(3,-16))), point(0,-5)) ) ;
@@ -22,5 +20,8 @@ insert into t1(a) values( geometrycollection(linestring(point(-33,99), point(
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
drop table t1;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test b/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test
index 928b1878e69..f606e569376 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test
@@ -75,19 +75,6 @@ SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
# MBROverlaps needs a few more tests, with point and line dimensions
---error ER_GIS_INVALID_DATA
-SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
---error ER_GIS_INVALID_DATA
-SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
---error ER_GIS_INVALID_DATA
-SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
---error ER_GIS_INVALID_DATA
-SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
---error ER_GIS_INVALID_DATA
-SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
---error ER_GIS_INVALID_DATA
-SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
-
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name;
SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL;
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index f1c30cba9fe..3df005068f0 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -964,10 +964,10 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
DROP TABLE t1;
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 7c78b0dcb71..83905fc9f3d 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -50,6 +50,98 @@ double my_double_round(double value, longlong dec, bool dec_unsigned,
#define MAX_DIGITS_IN_DOUBLE MY_GCVT_MAX_FIELD_WIDTH
+int MBR::within(const MBR *mbr)
+{
+ /*
+ We have to take into account the 'dimension' of
+ the MBR, where the dimension of a single point is 0,
+ the dimesion of an vertical or horizontal line is 1,
+ and finally the dimension of the solid rectangle is 2.
+ */
+
+ int dim1= dimension();
+ int dim2= mbr->dimension();
+
+ DBUG_ASSERT(dim1 >= 0 && dim1 <= 2 && dim2 >= 0 && dim2 <= 2);
+
+ /*
+ Either/both of the two operands can degrade to a point or a
+ horizontal/vertical line segment, and we have to treat such cases
+ separately.
+ */
+ switch (dim1)
+ {
+ case 0:
+ DBUG_ASSERT(xmin == xmax && ymin == ymax);
+ switch (dim2)
+ {
+ case 0:
+ DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax);
+ return equals(mbr);
+ break;
+ case 1:
+ DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) ||
+ (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax));
+ return ((xmin > mbr->xmin && xmin < mbr->xmax && ymin == mbr->ymin) ||
+ (ymin > mbr->ymin && ymin < mbr->ymax && xmin == mbr->xmin));
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return (xmin > mbr->xmin && xmax < mbr->xmax &&
+ ymin > mbr->ymin && ymax < mbr->ymax);
+ break;
+ }
+ break;
+ case 1:
+ DBUG_ASSERT((xmin == xmax && ymin != ymax) ||
+ (ymin == ymax && xmin != xmax));
+ switch (dim2)
+ {
+ case 0:
+ DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax);
+ return 0;
+ break;
+ case 1:
+ DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) ||
+ (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax));
+ return ((xmin == xmax && mbr->xmin == mbr->xmax && mbr->xmin == xmin &&
+ mbr->ymin <= ymin && mbr->ymax >= ymax) ||
+ (ymin == ymax && mbr->ymin == mbr->ymax && mbr->ymin == ymin &&
+ mbr->xmin <= xmin && mbr->xmax >= xmax));
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return ((xmin == xmax && xmin > mbr->xmin && xmax < mbr->xmax &&
+ ymin >= mbr->ymin && ymax <= mbr->ymax) ||
+ (ymin == ymax && ymin > mbr->ymin && ymax < mbr->ymax &&
+ xmin >= mbr->xmin && xmax <= mbr->xmax));
+ break;
+ }
+ break;
+ case 2:
+ DBUG_ASSERT(xmin != xmax && ymin != ymax);
+ switch (dim2)
+ {
+ case 0:
+ case 1:
+ return 0;
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) &&
+ (mbr->xmax >= xmax) && (mbr->ymax >= ymax));
+ break;
+
+ }
+ break;
+ }
+
+ // Never reached.
+ DBUG_ASSERT(false);
+ return 0;
+}
+
+
/***************************** Gis_class_info *******************************/
String Geometry::bad_geometry_data("Bad object", &my_charset_bin);
diff --git a/sql/spatial.h b/sql/spatial.h
index 76dbd06fdf4..e78da6e615d 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -145,12 +145,7 @@ struct MBR
(mbr->xmax >= xmin && mbr->xmax <= xmax)));
}
- int within(const MBR *mbr)
- {
- /* The following should be safe, even if we compare doubles */
- return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) &&
- (mbr->xmax >= xmax) && (mbr->ymax >= ymax));
- }
+ int within(const MBR *mbr);
int contains(const MBR *mbr)
{