MDEV-35021 Behavior for RTREE indexes changed, assertion fails

disallow USING RTREE for not SPATIAL index
This commit is contained in:
Sergei Golubchik 2024-09-30 22:59:47 +02:00
parent b3afd9f640
commit d396fb9226
3 changed files with 19 additions and 1 deletions

View file

@ -42,3 +42,11 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a);
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

View file

@ -14,3 +14,13 @@ DROP TABLE t1;
--error ER_WRONG_USAGE
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

View file

@ -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());
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");
DBUG_RETURN(TRUE);