mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-13626 Merge InnoDB test cases from MySQL 5.7 (part 2)
Import the changes to innodb.innodb-index innodb.innodb-index-debug Note: As noted in MDEV-13613, due to the behaviour change in MDEV-11114, DROP COLUMN will not imply DROP/ADD PRIMARY/UNIQUE KEY, like it does in MySQL. The tests have been adjusted accordingly.
This commit is contained in:
@@ -1184,3 +1184,667 @@ t2c CREATE TABLE `t2c` (
|
||||
KEY `t2a` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1,t2,t2c,t2i;
|
||||
#
|
||||
# Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
|
||||
#
|
||||
SET GLOBAL innodb_monitor_enable = module_ddl;
|
||||
create table t1(f1 int not null, f2 blob)engine=innodb;
|
||||
insert into t1 values(1, repeat('a',20000));
|
||||
# Skip sort
|
||||
# Reusing the same pk
|
||||
alter table t1 force;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
drop table t1;
|
||||
create table t1(f1 int not null, f2 int not null,
|
||||
primary key(f1))engine=innodb;
|
||||
insert into t1 values(1,2), (3,4);
|
||||
# Add Secondary index.
|
||||
# Skip temp file usage due to small table size
|
||||
alter table t1 add key(f2);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
drop table t1;
|
||||
create table t480(a serial)engine=innodb;
|
||||
insert into t480
|
||||
values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),
|
||||
(),(),(),(),(),(),(),();
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
create table t1(f1 int auto_increment not null,
|
||||
f2 char(200) not null, f3 char(200) not null,
|
||||
f4 char(200) not null,primary key(f1))engine=innodb;
|
||||
insert into t1 select NULL,'aaa','bbb','ccc' from t480;
|
||||
insert into t1 select NULL,'aaaa','bbbb','cccc' from t480;
|
||||
insert into t1 select NULL,'aaaaa','bbbbb','ccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaa','bbbbbb','cccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaaa','bbbbbbb','ccccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaaaa','bbbbbbbb','cccccccc' from t480;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2880
|
||||
# Skip sort
|
||||
# Change PK from (f1) to (f1,f2,f3,f4)
|
||||
alter table t1 drop primary key, add primary key(f1,f2,f3,f4);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Change PK from (f1,f2,f3,f4) to (f1,f2,added_columns)
|
||||
alter table t1 drop primary key,add column f5 int not null,
|
||||
add column f6 int not null,add primary key(f1,f2,f5,f6);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Change PK from (f1,f2,f5,f6) to (f1,f2,f5)
|
||||
alter table t1 drop column f6;
|
||||
ERROR 42000: Key column 'f6' doesn't exist in table
|
||||
alter table t1 drop column f6, drop primary key, add primary key(f1,f2,f5);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Reusing the same PK
|
||||
alter table t1 add column f6 int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Reusing the same pk
|
||||
alter table t1 drop column f6;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Must sort
|
||||
# Change PK from (f1,f2,f5) to (f1,f5)
|
||||
alter table t1 drop column f2;
|
||||
ERROR 42000: Key column 'f2' doesn't exist in table
|
||||
alter table t1 drop column f2, drop primary key, add primary key(f1,f5);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
ddl_sort_file_alter_table 2
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Reusing the same pk
|
||||
alter table t1 add column f2n int after f1, drop primary key, add
|
||||
primary key (f1,f5,f2n);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Reusing the same pk
|
||||
alter table t1 change f5 f2n int not null,change f2n f5 int not null,
|
||||
add column f8 int not null;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Change PK from (f1,f4,f2n) to (f1,f4,added_column,f2n)
|
||||
alter table t1 add column f7 int, drop primary key,
|
||||
add primary key (f1,f5,f7,f2n);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
ddl_sort_file_alter_table 2
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Reusing the same pk
|
||||
alter table t1 force;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Reusing the same pk
|
||||
alter table t1 row_format=compact;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Reusing the same pk
|
||||
alter table t1 engine=innodb;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Optimize table
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
affected rows: 2
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Sort files used for adding secondary index
|
||||
alter table t1 drop primary key, add primary key(f1,f5,f7), add index
|
||||
i(f3);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# No sort files used for dropping secondary index
|
||||
alter table t1 drop primary key, add primary key(f1,f5),drop index i;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Change PK(f1,f5) to (f1,added_columns) and drop f5
|
||||
alter table t1 drop primary key, add primary key(f1,f12),
|
||||
drop column f5, add column f12 int not null;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Must sort
|
||||
# Change PK(f1,f12) to (f1,existing_columns)
|
||||
alter table t1 drop primary key, add primary key(f1,f3);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
ddl_sort_file_alter_table 2
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort
|
||||
# Change PK(f1,f3) to (f1,added_column,f3,added_column)
|
||||
alter table t1 drop primary key, add column f3n int,
|
||||
add column f4n int, add primary key(f1,f3n,f3,f4n);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Adding Secondary index alone.
|
||||
alter table t1 add key(f1);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Must sort
|
||||
# Change PK(f1,f3) to (existing_column,f1)
|
||||
alter table t1 drop primary key, add primary key(f4,f1);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
ddl_sort_file_alter_table 3
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort for PK.
|
||||
# Change PK(f4,f1) to (added_columns,f4,f1)
|
||||
# Secondary index rebuild happens
|
||||
alter table t1 drop primary key, add column f5n int,
|
||||
add column f6n int, add primary key(f5n,f6n,f4,f1);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
# Skip sort for PK.
|
||||
# Change PK(f5n,f6n,f4,f1) to
|
||||
# (added_columns,f5n,added_column,f6n,f4,f1)
|
||||
# Secondary index rebuild happens
|
||||
alter table t1 drop primary key, add column f7n int,
|
||||
add column f8n int, add primary key(f7n,f5n,f8n,f6n,f4,f1);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE
|
||||
subsystem = 'ddl' and count_reset > 0;
|
||||
name count_reset
|
||||
SET GLOBAL innodb_monitor_reset = module_ddl;
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2880
|
||||
drop table t1;
|
||||
SET GLOBAL innodb_monitor_reset = default;
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
SET GLOBAL innodb_monitor_disable = default;
|
||||
# Bug#19163915 INNODB: DUPLICATE RECORDS COULD EXIST
|
||||
# WHEN SKIPPING SORT FOR CLUSTER INDEX
|
||||
SELECT @@innodb_sort_buffer_size;
|
||||
@@innodb_sort_buffer_size
|
||||
1048576
|
||||
create table t1(f1 int auto_increment not null,
|
||||
f2 char(200) not null, f3 char(200) not null,
|
||||
f4 char(200) not null,primary key(f1,f2,f3,f4));
|
||||
insert into t1 select NULL,'aaa','bbb','ccc' from t480;
|
||||
insert into t1 values(106, 'aaa','bbb','cccc');
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
481
|
||||
# Skip sort
|
||||
# Change PK from (f1,f2,f3,f4) to (f1,f2,f3)
|
||||
alter table t1 drop primary key, add primary key(f1,f2,f3);
|
||||
ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '106-aaa-bbb' for key 'PRIMARY'
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
481
|
||||
drop table t1;
|
||||
create table t1(f1 int auto_increment not null,
|
||||
f2 char(200) not null, f3 char(200) not null,
|
||||
f4 char(200) not null,primary key(f1,f2,f3,f4));
|
||||
insert into t1 select NULL,'aaa','bbb','ccc' from t480;
|
||||
insert into t1 values(108,'aaa','bbb','cccc');
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
481
|
||||
alter table t1 drop primary key, add primary key(f1,f2,f3);
|
||||
ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '108-aaa-bbb' for key 'PRIMARY'
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
481
|
||||
drop table t1, t480;
|
||||
#
|
||||
# Bug #19896922 SORTING SKIPPED WHEN PREFIX LENGTH OF THE PK
|
||||
# FIELD IS CHANGED
|
||||
#
|
||||
create table t1(a int not null, b varchar(30) not null,
|
||||
primary key (b(10), a)) engine = innodb;
|
||||
insert into t1 values(0,'khdHps6UxW8Lwaoxa604oK6zkb'),(1,'khdHps6UxW8L');
|
||||
select * from t1;
|
||||
a b
|
||||
0 khdHps6UxW8Lwaoxa604oK6zkb
|
||||
1 khdHps6UxW8L
|
||||
alter table t1 drop primary key, add primary key (b(18),a);
|
||||
select * from t1;
|
||||
a b
|
||||
1 khdHps6UxW8L
|
||||
0 khdHps6UxW8Lwaoxa604oK6zkb
|
||||
drop table t1;
|
||||
create table t1(a int not null, b varchar(30) not null,
|
||||
primary key (b(10), a)) engine = innodb;
|
||||
insert into t1 values(0,'khdHps6UxW8Lwaoxa604oK6zkb'),(1,'khdHps6UtW8L');
|
||||
select * from t1;
|
||||
a b
|
||||
1 khdHps6UtW8L
|
||||
0 khdHps6UxW8Lwaoxa604oK6zkb
|
||||
alter table t1 drop primary key, add primary key (b(8),a);
|
||||
select * from t1;
|
||||
a b
|
||||
0 khdHps6UxW8Lwaoxa604oK6zkb
|
||||
1 khdHps6UtW8L
|
||||
drop table t1;
|
||||
#
|
||||
# Bug #21103101 SORTING SKIPPED WHEN DROPPING THE SINGLE
|
||||
# COLUMN PRIMARY KEY
|
||||
#
|
||||
create table t1(f1 int not null, f2 int not null,
|
||||
primary key (f1), unique key(f1, f2))engine=innodb;
|
||||
insert into t1 values(1,3), (2,2);
|
||||
alter table t1 drop column f1;
|
||||
ERROR 42000: Key column 'f1' doesn't exist in table
|
||||
alter table t1 drop column f1, drop primary key;
|
||||
ERROR 42000: Key column 'f1' doesn't exist in table
|
||||
alter table t1 drop column f1, drop key f1;
|
||||
drop table t1;
|
||||
create table t1(f1 int not null, f2 int not null,
|
||||
primary key (f1), unique key(f1, f2))engine=innodb;
|
||||
insert into t1 values(1,3), (2,2);
|
||||
alter table t1 drop primary key, lock=none;
|
||||
ERROR 0A000: LOCK=NONE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try LOCK=SHARED
|
||||
drop table t1;
|
||||
#
|
||||
# BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP
|
||||
# LAST COLUMN OF OLD PK
|
||||
#
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1,o3), drop o2, lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 drop o1, drop o2, add primary key(o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 drop primary key, add primary key(o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 add column n1 int not null, drop primary key, add primary key(n1,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,2,1);
|
||||
alter table t1 add column n1 int not null, drop primary key, add primary key(o3,n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,2,2),(2,1,1);
|
||||
alter table t1 drop primary key, add primary key(o2, o1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,2,2),(2,1,1);
|
||||
alter table t1 drop primary key, add primary key(o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,2,2),(2,1,1);
|
||||
alter table t1 drop primary key, add primary key(o2,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o2,o1)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,1,1);
|
||||
alter table t1 drop primary key, add primary key(o2,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1,o3,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,2,2),(2,1,1);
|
||||
alter table t1 drop primary key, add primary key(o3,o1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,2,2),(2,1,1);
|
||||
alter table t1 drop o1, lock=none;
|
||||
ERROR 42000: Key column 'o1' doesn't exist in table
|
||||
alter table t1 drop o1, drop primary key, add primary key(o2,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(1,2,1);
|
||||
alter table t1 drop o2, lock=none;
|
||||
ERROR 42000: Key column 'o2' doesn't exist in table
|
||||
alter table t1 drop o2, drop primary key, add primary key(o1,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,2,2),(2,1,1);
|
||||
alter table t1 drop o1, drop o2, lock=none;
|
||||
ERROR 42000: Key column 'o2' doesn't exist in table
|
||||
alter table t1 drop o1, drop o2,drop primary key,add primary key(o3),lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1, 1), ('abc', 2, 2);
|
||||
alter table t1 drop primary key, add primary key(o1(3), o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1, 1), ('abc', 2, 2);
|
||||
alter table t1 drop primary key, add primary key(o1, o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1, 1), ('abc', 2, 2);
|
||||
alter table t1 drop primary key, add primary key(o1(3), o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1, 1), ('abc', 2, 2);
|
||||
alter table t1 drop primary key, add primary key(o1, o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(3), o2)) engine = innodb;
|
||||
insert into t1 values('abc', 2, 1), ('abd', 1, 2);
|
||||
alter table t1 drop primary key, add primary key(o1(2), o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1, o2)) engine = innodb;
|
||||
insert into t1 values('abc', 2, 1), ('abd', 1, 2);
|
||||
alter table t1 drop primary key, add primary key(o1(2), o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(3), o2)) engine = innodb;
|
||||
insert into t1 values('abc', 2, 2), ('abd', 1, 1);
|
||||
alter table t1 drop primary key, add primary key(o1(2), o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1, o2)) engine = innodb;
|
||||
insert into t1 values('abc', 2, 2), ('abd', 1, 1);
|
||||
alter table t1 drop primary key, add primary key(o1(2), o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2(2),o3)) engine = innodb;
|
||||
insert into t1 values(1, 'abd', 1), (1, 'abc', 2);
|
||||
alter table t1 drop primary key, add primary key(o1,o2(3)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2(2),o3)) engine = innodb;
|
||||
insert into t1 values(1, 'abd', 1), (1, 'abc', 2);
|
||||
alter table t1 drop primary key, add primary key(o1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(3))) engine = innodb;
|
||||
insert into t1 values('abc', 'acd'), ('abd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1(2),o2(3)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values('abc', 'acd'), ('abd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1(2),o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(3))) engine = innodb;
|
||||
insert into t1 values('abd', 'acd'), ('acd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o2(3),o1(3)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values('abd', 'acd'), ('acd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o2,o1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb;
|
||||
insert into t1 values('abd'), ('acd');
|
||||
alter table t1 drop primary key, add primary key(o1(3)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb;
|
||||
insert into t1 values('abd'), ('acd');
|
||||
alter table t1 drop primary key, add primary key(o1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb;
|
||||
insert into t1 values('abd'), ('acd');
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1(3), n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb;
|
||||
insert into t1 values('abd'), ('acd');
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1, n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int not null, primary key(o1(2))) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1(3), o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int not null, primary key(o1(2))) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1, o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), primary key(o1(3))) engine = innodb;
|
||||
insert into t1 values('abd'), ('acd');
|
||||
alter table t1 drop primary key, add primary key(o1(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), primary key(o1)) engine = innodb;
|
||||
insert into t1 values('abd'), ('acd');
|
||||
alter table t1 drop primary key, add primary key(o1(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 drop primary key, add primary key(o1(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 drop primary key, add primary key(o1(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1(2),n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1(2),n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1(3),n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb;
|
||||
insert into t1 values('abd', 1), ('acd', 2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), primary key(o1,o2(3))) engine = innodb;
|
||||
insert into t1 values(1,'abd'), (2,'acd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values(1,'abd'), (2,'acd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), primary key(o1,o2(2))) engine = innodb;
|
||||
insert into t1 values(1, 'abd'), (2, 'acd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2(3)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), primary key(o1,o2(2))) engine = innodb;
|
||||
insert into t1 values(1, 'abd'), (2, 'acd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2(3),o3)) engine = innodb;
|
||||
insert into t1 values(1, 'abd', 1), (2, 'acd', 2);
|
||||
alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1, 'abd', 1), (2, 'acd', 2);
|
||||
alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(3))) engine = innodb;
|
||||
insert into t1 values('abd', 'acd'), ('acd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1(3),o2(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2)) engine = innodb;
|
||||
insert into t1 values('abd', 'acd'), ('acd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(2))) engine = innodb;
|
||||
insert into t1 values('abd', 'acd'), ('acd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1(3),o2(3)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2(2))) engine = innodb;
|
||||
insert into t1 values('abd', 'acd'), ('acd', 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1(3),o2,o3(2))) engine = innodb;
|
||||
insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1(3),o2,o3(3)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1,o2,o3(2))) engine = innodb;
|
||||
insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1(3),o2,o3(3))) engine = innodb;
|
||||
insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1(3),o2,o3(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1,o2,o3(3))) engine = innodb;
|
||||
insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd');
|
||||
alter table t1 drop primary key, add primary key(o1,o2,o3(2)), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 drop primary key, add primary key(o1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(n1,o1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(n1,o1,n2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(n1,n2,o1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(o1,n1,n2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(n1,o1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, o3 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1,o2,o3), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int not null, o3 int not null, primary key(o1)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1,o3,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, o4 int not null, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,1,2,2),(2,2,1,1);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,o3,o4), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,2,1);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,n1), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,2,1);
|
||||
alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1,o2), lock=none;
|
||||
drop table t1;
|
||||
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
|
||||
insert into t1 values(1,1,2),(2,2,1);
|
||||
alter table t1 drop primary key, add primary key(o1), lock=none;
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user