diff options
author | unknown <gluh@eagle.(none)> | 2007-10-23 18:51:43 +0500 |
---|---|---|
committer | unknown <gluh@eagle.(none)> | 2007-10-23 18:51:43 +0500 |
commit | 8479eb1db7d1c8ccfbaa62077c54b7f5af714324 (patch) | |
tree | d36465f86e78c442a44942849b7280eab8d10bf8 /mysql-test/include | |
parent | fb9a562b1cc2b9048eff094bb7004fb3db0e7fd0 (diff) | |
parent | c448d2ed5d2a7efd1f77b956f46d8f1e48b17350 (diff) | |
download | mariadb-git-8479eb1db7d1c8ccfbaa62077c54b7f5af714324.tar.gz |
Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt
client/mysqldump.c:
Auto merged
include/config-win.h:
Auto merged
libmysql/libmysql.c:
Auto merged
myisam/sort.c:
Auto merged
mysql-test/r/func_sapdb.result:
Auto merged
mysql-test/r/variables.result:
Auto merged
mysql-test/t/variables.test:
Auto merged
sql/field.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/r/type_datetime.result:
manual merge
mysql-test/r/type_decimal.result:
manual merge
mysql-test/t/type_datetime.test:
manual merge
mysql-test/t/type_decimal.test:
manual merge
sql/item.cc:
manual merge
Diffstat (limited to 'mysql-test/include')
-rw-r--r-- | mysql-test/include/gis_keys.inc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/include/gis_keys.inc b/mysql-test/include/gis_keys.inc new file mode 100644 index 00000000000..295e0c48234 --- /dev/null +++ b/mysql-test/include/gis_keys.inc @@ -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 |