-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
close #51431
- Loading branch information
1 parent
19731df
commit 18c7f08
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
drop table if exists t; | ||
create table t (pk int primary key, c int default 1, c1 int default 1, unique key k1(c), key k2(c1)); | ||
alter table t rename index k1 to k3; | ||
admin check index t k3; | ||
alter table t rename index k3 to k3; | ||
admin check index t k3; | ||
alter table t rename index x to x; | ||
Error 1176 (42000): Key 'x' doesn't exist in table 't' | ||
alter table t rename index k3 to k2; | ||
Error 1061 (42000): Duplicate key name 'k2' | ||
alter table t rename index k2 to K2; | ||
alter table t rename key k3 to K2; | ||
Error 1061 (42000): Duplicate key name 'K2' | ||
drop table t; | ||
create table t(j json); | ||
alter table t add index idx1((cast(j as char(10) array))); | ||
alter table t rename index idx1 to idx2; | ||
alter table t add index idx1((cast(j as char(10) array))); | ||
insert into t values ('["1"]'); | ||
alter table t add index IDX3((cast(j as char(10) array))); | ||
alter table t rename index IDX3 to IDX4; | ||
alter table t add index IDX3((cast(j as char(10) array))); | ||
insert into t values ('["2"]'); | ||
select * from t; | ||
j | ||
["1"] | ||
["2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# TestRenameIndex | ||
drop table if exists t; | ||
create table t (pk int primary key, c int default 1, c1 int default 1, unique key k1(c), key k2(c1)); | ||
alter table t rename index k1 to k3; | ||
admin check index t k3; | ||
alter table t rename index k3 to k3; | ||
admin check index t k3; | ||
-- error 1176 | ||
alter table t rename index x to x; | ||
-- error 1061 | ||
alter table t rename index k3 to k2; | ||
alter table t rename index k2 to K2; | ||
-- error 1061 | ||
alter table t rename key k3 to K2; | ||
|
||
# TestIssue51431 | ||
drop table t; | ||
create table t(j json); | ||
alter table t add index idx1((cast(j as char(10) array))); | ||
alter table t rename index idx1 to idx2; | ||
alter table t add index idx1((cast(j as char(10) array))); | ||
insert into t values ('["1"]'); | ||
alter table t add index IDX3((cast(j as char(10) array))); | ||
alter table t rename index IDX3 to IDX4; | ||
alter table t add index IDX3((cast(j as char(10) array))); | ||
insert into t values ('["2"]'); | ||
select * from t; |