mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-7318 RENAME INDEX
This patch adds support of RENAME INDEX operation to the ALTER TABLE statement. Code which determines if ALTER TABLE can be done in-place for "simple" storage engines like MyISAM, Heap and etc. was updated to handle ALTER TABLE ... RENAME INDEX as an in-place operation. Support for in-place ALTER TABLE ... RENAME INDEX for InnoDB was covered by MDEV-13301. Syntax changes ============== A new type of <alter_specification> is added: <rename index clause> ::= RENAME ( INDEX | KEY ) <oldname> TO <newname> Where <oldname> and <newname> are identifiers for old name and new name of the index. Semantic changes ================ The result of "ALTER TABLE t1 RENAME INDEX a TO b" is a table which contents and structure are identical to the old version of 't1' with the only exception index 'a' being called 'b'. Neither <oldname> nor <newname> can be "primary". The index being renamed should exist and its new name should not be occupied by another index on the same table. Related to: WL#6555, MDEV-13301
This commit is contained in:
@ -355,6 +355,21 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Alter_rename_key : public Sql_alloc
|
||||
{
|
||||
public:
|
||||
LEX_CSTRING old_name;
|
||||
LEX_CSTRING new_name;
|
||||
|
||||
Alter_rename_key(LEX_CSTRING old_name_arg, LEX_CSTRING new_name_arg)
|
||||
: old_name(old_name_arg), new_name(new_name_arg) {}
|
||||
|
||||
Alter_rename_key *clone(MEM_ROOT *mem_root) const
|
||||
{ return new (mem_root) Alter_rename_key(*this); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
class Key :public Sql_alloc, public DDL_options {
|
||||
public:
|
||||
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY};
|
||||
|
Reference in New Issue
Block a user