Commit c2963e5f authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-35021 Behavior for RTREE indexes changed, assertion fails

disallow USING RTREE for not SPATIAL index
parent e5b48fae
...@@ -42,3 +42,11 @@ t1 CREATE TABLE `t1` ( ...@@ -42,3 +42,11 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1; DROP TABLE t1;
CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a); CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a);
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
#
# MDEV-35021 Behavior for RTREE indexes changed, assertion fails
#
create table t (f int not null);
create index ind using rtree on t (f);
ERROR HY000: Incorrect arguments to RTREE INDEX
drop table t;
# End of 11.7 tests
...@@ -14,3 +14,13 @@ DROP TABLE t1; ...@@ -14,3 +14,13 @@ DROP TABLE t1;
--error ER_WRONG_USAGE --error ER_WRONG_USAGE
CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a); CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a);
--echo #
--echo # MDEV-35021 Behavior for RTREE indexes changed, assertion fails
--echo #
create table t (f int not null);
--error ER_WRONG_ARGUMENTS
create index ind using rtree on t (f);
drop table t;
--echo # End of 11.7 tests
...@@ -3347,7 +3347,7 @@ mysql_prepare_create_table_finalize(THD *thd, HA_CREATE_INFO *create_info, ...@@ -3347,7 +3347,7 @@ mysql_prepare_create_table_finalize(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0), file->table_type()); my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0), file->table_type());
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (key_info->user_defined_key_parts != 1) if (key->type != Key::SPATIAL || key_info->user_defined_key_parts != 1)
{ {
my_error(ER_WRONG_ARGUMENTS, MYF(0), "RTREE INDEX"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "RTREE INDEX");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment