summaryrefslogtreecommitdiff
path: root/mysql-test/r/innodb_gis.result
diff options
context:
space:
mode:
authorgkodinov/kgeorge@magare.gmz <>2007-10-10 16:26:02 +0300
committergkodinov/kgeorge@magare.gmz <>2007-10-10 16:26:02 +0300
commite971b18f0690c723dac547bcdcaaa8ba9ff2850b (patch)
tree10232e94f6ae12c66b7122e5c199c8de76b8add1 /mysql-test/r/innodb_gis.result
parent20ec6605d349c3cfa5c062a9818612616bbe3baa (diff)
downloadmariadb-git-e971b18f0690c723dac547bcdcaaa8ba9ff2850b.tar.gz
Bug #30825: Problems when putting a non-spatial index on a GIS column
Fixed the usage of spatial data (and Point in specific) with non-spatial indexes. Several problems : - The length of the Point class was not updated to include the spatial reference system identifier. Fixed by increasing with 4 bytes. - The storage length of the spatial columns was not accounting for the length that is prepended to it. Fixed by treating the spatial data columns as blobs (and thus increasing the storage length) - When creating the key image for comparison in index read wrong key image was created (the one needed for and r-tree search, not the one for b-tree/other search). Fixed by treating the spatial data columns as blobs (and creating the correct kind of image based on the index type).
Diffstat (limited to 'mysql-test/r/innodb_gis.result')
-rw-r--r--mysql-test/r/innodb_gis.result39
1 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/r/innodb_gis.result
index 2c62537aa94..bfe8c984b7b 100644
--- a/mysql-test/r/innodb_gis.result
+++ b/mysql-test/r/innodb_gis.result
@@ -542,3 +542,42 @@ Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
End of 5.0 tests
+CREATE TABLE t1 (p POINT);
+CREATE TABLE t2 (p POINT, INDEX(p));
+INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
+INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
+SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+1
+EXPLAIN
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref p p 28 const 1 Using where
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+1
+INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
+INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
+EXPLAIN
+SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+2
+EXPLAIN
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref p p 28 const 1 Using where
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+2
+EXPLAIN
+SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
+SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+2
+DROP TABLE t1, t2;
+End of 5.0 tests