Browse Source
Merge magare.gmz:/home/kgeorge/mysql/autopush/B30825-new-5.0-opt
Merge magare.gmz:/home/kgeorge/mysql/autopush/B30825-new-5.0-opt
into magare.gmz:/home/kgeorge/mysql/work/B30825-5.1-opt mysql-test/r/gis-rtree.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/t/gis.test: Auto merged BitKeeper/deleted/.del-bdb_gis.result: Auto merged BitKeeper/deleted/.del-bdb_gis.test: Auto merged sql/sql_table.cc: Auto merged mysql-test/r/innodb_gis.result: merged 5.0-opt -> 5.1-opt mysql-test/t/innodb_gis.test: merged 5.0-opt -> 5.1-opt sql/field.cc: merged 5.0-opt -> 5.1-opt sql/field.h: merged 5.0-opt -> 5.1-opt sql/sql_select.h: merged 5.0-opt -> 5.1-opt sql/sql_yacc.yy: merged 5.0-opt -> 5.1-opt sql/table.cc: merged 5.0-opt -> 5.1-optpull/374/head
12 changed files with 140 additions and 39 deletions
-
46mysql-test/include/gis_keys.inc
-
4mysql-test/r/gis-rtree.result
-
39mysql-test/r/gis.result
-
38mysql-test/r/innodb_gis.result
-
2mysql-test/t/gis.test
-
1mysql-test/t/innodb_gis.test
-
30sql/field.cc
-
1sql/field.h
-
8sql/sql_select.h
-
2sql/sql_table.cc
-
2sql/sql_yacc.yy
-
6sql/table.cc
@ -0,0 +1,46 @@ |
|||
--source include/have_geometry.inc |
|||
|
|||
# |
|||
# Spatial objects with keys |
|||
# |
|||
|
|||
# |
|||
# Bug #30825: Problems when putting a non-spatial index on a GIS column |
|||
# |
|||
|
|||
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)')); |
|||
|
|||
-- no index, returns 1 as expected |
|||
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
|
|||
-- with index, returns 1 as expected |
|||
-- EXPLAIN shows that the index is not used though |
|||
-- due to the "most rows covered anyway, so a scan is more effective" rule |
|||
EXPLAIN |
|||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
|
|||
-- adding another row to the table so that |
|||
-- the "most rows covered" rule doesn't kick in anymore |
|||
-- now EXPLAIN shows the index used on the table |
|||
-- and we're getting the wrong result again |
|||
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)'); |
|||
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
|
|||
EXPLAIN |
|||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
|
|||
EXPLAIN |
|||
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); |
|||
|
|||
DROP TABLE t1, t2; |
|||
|
|||
--echo End of 5.0 tests |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue