Commit f006f151 authored by Rich Prohaska's avatar Rich Prohaska

#4621 move tokudb.alter_table mysql tests to common mysql test dir. sort out later. refs[t:4621]

git-svn-id: file:///svn/mysql/tests/mysql-test@40916 c7de825b-a66e-492c-adef-691d508d4ae1
parent 642a4fb6
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b int, c int, key(a))engine=TokuDB;
insert into foo values (1,10,100),(2,20,200),(3,30,300),(3,30,300);
select * from foo;
a b c
1 10 100
2 20 200
3 30 300
3 30 300
explain select sum(a) from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL a 5 NULL 4 Using index
select sum(a) from foo;
sum(a)
9
alter table foo add unique index b(b), drop index a;
ERROR 23000: Can't write; duplicate key in table 'foo'
select * from foo;
a b c
1 10 100
2 20 200
3 30 300
3 30 300
explain select sum(a) from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL a 5 NULL 4 Using index
select sum(a) from foo;
sum(a)
9
#test that we can still add an index named 'b'
alter table foo add index b(b);
explain select sum(b) from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 4 Using index
select sum(b) from foo;
sum(b)
90
set autocommit=0;
drop index b on foo;
create index b on foo (b);
explain select sum(b) from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 4 Using index
select sum(b) from foo;
sum(b)
90
set autocommit=1;
drop table foo;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
select * from foo order by b desc;
a b c d
2 20 200 20
1 10 100 20
-1 -1 -1 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
select * from foo order by b desc;
a b c d
3 30 300 3000
2 20 200 20
1 10 100 20
-1 -1 -1 20
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
select * from foo order by b desc;
a b c
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
select * from foo order by b desc;
a b c
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
select * from foo order by b desc;
d a b c
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
select * from foo order by b desc;
d a b c
5 50 500 5000
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
select * from foo order by b desc;
a b c
50 500 5000
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
6 60 600
50 500 5000
select * from foo order by b desc;
a b c
50 500 5000
6 60 600
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
drop table foo;
drop table bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
select * from foo order by b desc;
a b c d
2 20 200 20
1 10 100 20
-1 -1 -1 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
select * from foo order by b desc;
a b c d
3 30 300 3000
2 20 200 20
1 10 100 20
-1 -1 -1 20
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
select * from foo order by b desc;
a b c
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
select * from foo order by b desc;
a b c
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
select * from foo order by b desc;
d a b c
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
select * from foo order by b desc;
d a b c
5 50 500 5000
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
select * from foo order by b desc;
a b c
50 500 5000
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
6 60 600
50 500 5000
select * from foo order by b desc;
a b c
50 500 5000
6 60 600
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
drop table foo;
drop table bar;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
select * from foo order by b desc;
a b c d
2 20 200 20
1 10 100 20
-1 -1 -1 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
select * from foo order by b desc;
a b c d
3 30 300 3000
2 20 200 20
1 10 100 20
-1 -1 -1 20
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
select * from foo order by b desc;
a b c
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
select * from foo order by b desc;
a b c
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
select * from foo order by b desc;
d a b c
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
select * from foo order by b desc;
d a b c
5 50 500 5000
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
select * from foo order by b desc;
a b c
50 500 5000
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
6 60 600
select * from foo order by b desc;
a b c
6 60 600
50 500 5000
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
drop table foo;
drop table bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
select * from foo order by b desc;
a b c d
2 20 200 20
1 10 100 20
-1 -1 -1 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
select * from foo order by b desc;
a b c d
3 30 300 3000
2 20 200 20
1 10 100 20
-1 -1 -1 20
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
select * from foo order by b desc;
a b c
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
select * from foo order by b desc;
a b c
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
select * from foo order by b desc;
d a b c
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
select * from foo order by b desc;
d a b c
5 50 500 5000
20 4 40 400
20 3 30 300
20 2 20 200
20 1 10 100
20 -1 -1 -1
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
select * from foo order by b desc;
a b c
50 500 5000
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
6 60 600
select * from foo order by b desc;
a b c
6 60 600
50 500 5000
4 40 400
3 30 300
2 20 200
1 10 100
-1 -1 -1
drop table foo;
drop table bar;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo(a varchar(10), b varchar (10), c varchar(10), d varchar(10))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL,NULL,NULL,NULL);
insert into foo values (NULL, "bobby",NULL,"heehee");
insert into foo values ("BIGGER",NULL,"smaller",NULL);
insert into foo values ("aaaaaaaaaa","bbbbbbbbbb","cccccccccc","dddddddddd");
insert into bar select * from foo;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) default NULL;
alter table bar add column e varchar(3000) default NULL;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) default NULL first;
alter table bar add column e varchar(3000) default NULL first;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) default NULL after b;
alter table bar add column e varchar(3000) default NULL after b;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) default "abracadabraabracadabra";
alter table bar add column e varchar(3000) default "abracadabraabracadabra";
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) default "abracadabraabracadabra" first;
alter table bar add column e varchar(3000) default "abracadabraabracadabra" first;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) default "abracadabraabracadabra" after b;
alter table bar add column e varchar(3000) default "abracadabraabracadabra" after b;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) default NULL after b;
alter table bar add column e varchar(3000) default NULL after b;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) NOT NULL default "abracadabraabracadabra";
alter table bar add column e varchar(3000) NOT NULL default "abracadabraabracadabra";
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) NOT NULL default "abracadabraabracadabra" first;
alter table bar add column e varchar(3000) NOT NULL default "abracadabraabracadabra" first;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e varchar(3000) NOT NULL default "abracadabraabracadabra" after b;
alter table bar add column e varchar(3000) NOT NULL default "abracadabraabracadabra" after b;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
drop table foo;
drop table bar;
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), clustering key (b))engine=TokuDB;
alter table foo drop column e;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column d;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column c;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column b;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int first;
alter table foo drop column aaa;
alter table foo add column aaa int first;
alter table foo drop column aaa, drop index d;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, add index (bb);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop index b, add index b(b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, drop index b, add index b(d);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, drop index b, add index b(b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, drop index b, add clustering index b(b(5));
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, drop index b, add clustering index b(b);
alter table foo add column aaa int, drop index d;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, add index (bb);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index b, add index b(b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index b, add index b(d);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index b, add unique index b(b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index b, add index b(b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index b, add clustering index b(b(5));
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index b, add clustering index b(b);
alter table foo drop column aaa, drop index c;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, add index (bb);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop index c, add index c(c);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, drop index c, add index c(d);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, drop index c, add index c(c);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop column aaa, drop index c, add unique index c(c);
alter table foo add column aaa int, drop index c;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, add index (bb);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index c, add index c(c);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index c, add index c(d);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index c, add clustering index c(c);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index c, add index c(c);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaa int, drop index c, add unique index c(c);
alter table foo add column aaaa int, drop column c;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaaa int, add column bbbb int, drop column c;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add column aaaa int, drop column c, drop column b;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
drop table foo;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (a int NOT NULL, b bigint NOT NULL, c tinyint NOT NULL, d int NOT NULL, primary key (b))engine=TokuDB;
insert into foo values (122,10,1,1000),(1,110,1,0),(0,3234,0,657),(0,0,0,0),(99,99,0,99), (-1,-1,-1,-1);
create table bar like foo;
alter table bar engine=MyISAM;
insert into bar select * from foo;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e int default NULL first;
alter table bar add column e int default NULL first;
select * from foo;
e a b c d
NULL -1 -1 -1 -1
NULL 0 0 0 0
NULL 122 10 1 1000
NULL 99 99 0 99
NULL 1 110 1 0
NULL 0 3234 0 657
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e int default -1 first;
alter table bar add column e int default -1 first;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column e;
alter table bar drop column e;
include/diff_tables.inc [test.foo, test.bar]
alter table foo add column e int NOT NULL default -1 first;
alter table bar add column e int NOT NULL default -1 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
e a b c d
-1 -1 -1 -1 -1
-1 0 0 0 0
-1 122 10 1 1000
-1 99 99 0 99
-1 1 110 1 0
-1 0 3234 0 657
drop table foo;
drop table bar;
create table foo (a int, b int not null, c int, d int not null, e int, primary key (e))engine=TokuDB;
alter table foo drop column e;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL, -1, NULL, -1,1),(0,0,0,0,0),(NULL,234,234,324,234),(98567,76,NULL,7668,90909);
insert into bar select * from foo;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column b;
alter table bar drop column b;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column a;
alter table bar drop column a;
include/diff_tables.inc [test.foo, test.bar]
drop table foo;
drop table bar;
create table foo (a varchar(20), b varchar(20) not null, c varchar(20), d varchar(20) not null, e int, primary key (e))engine=TokuDB;
alter table foo drop column e;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL, "-1", NULL, "-1",1),("dfg0","0rrr","eee0","qwert",0),(NULL,"234","234","324",234),("98567","76",NULL,"7668","90909");
insert into bar select * from foo;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column b;
alter table bar drop column b;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
alter table foo drop column a;
alter table bar drop column a;
include/diff_tables.inc [test.foo, test.bar]
drop table foo;
drop table bar;
create table foo(
a int,
b int,
c int,
d int,
e int,
f int,
g int,
h int,
aa int,
bb int,
cc int,
dd int
)engine = TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1);
insert into foo values (-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL);
insert into foo values (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
insert into foo values (-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
insert into bar select * from foo;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d e f g h aa bb cc dd
NULL -1 NULL -1 NULL -1 NULL -1 NULL -1 NULL -1
-1 NULL -1 NULL -1 NULL -1 NULL -1 NULL -1 NULL
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
alter table foo drop column a, drop column aa, drop column c, drop column cc, drop column e, drop column f;
alter table bar drop column a, drop column aa, drop column c, drop column cc, drop column e, drop column f;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
b d g h bb dd
-1 -1 NULL -1 -1 -1
NULL NULL -1 NULL NULL NULL
NULL NULL NULL NULL NULL NULL
-1 -1 -1 -1 -1 -1
alter table foo add column a int default -1 first, add column aa int NOT NULL default -1 after h, add column c int default NULL after b, add column cc int default 0 after bb, add column f int default NULL after d, add column e int NOT NULL default 12345 after d;
alter table bar add column a int default -1 first, add column aa int NOT NULL default -1 after h, add column c int default NULL after b, add column cc int default 0 after bb, add column f int default NULL after d, add column e int NOT NULL default 12345 after d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d e f g h aa bb cc dd
-1 -1 NULL -1 12345 NULL NULL -1 -1 -1 0 -1
-1 NULL NULL NULL 12345 NULL -1 NULL -1 NULL 0 NULL
-1 NULL NULL NULL 12345 NULL NULL NULL -1 NULL 0 NULL
-1 -1 NULL -1 12345 NULL -1 -1 -1 -1 0 -1
drop table foo;
drop table bar;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
6 60 600
50 500 5000
drop table foo;
drop table bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
6 60 600
50 500 5000
drop table foo;
drop table bar;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
6 60 600
drop table foo;
drop table bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
a b c d
-1 -1 -1 20
1 10 100 20
2 20 200 20
3 30 300 3000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
d a b c
20 -1 -1 -1
20 1 10 100
20 2 20 200
20 3 30 300
20 4 40 400
5 50 500 5000
alter table foo drop column d;
alter table bar drop column d;
include/diff_tables.inc [test.foo, test.bar]
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
a b c
-1 -1 -1
1 10 100
2 20 200
3 30 300
4 40 400
50 500 5000
6 60 600
drop table foo;
drop table bar;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
set session tokudb_disable_slow_alter=ON;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS bar;
set session tokudb_disable_slow_alter=ON;
create temporary table bar (a int, key(a))engine=TOkuDB;
alter table bar add column c int;
ERROR 42000: Table 'bar' uses an extension that doesn't exist in this MySQL version
create index blah on bar(a);
ERROR 42000: Table 'bar' uses an extension that doesn't exist in this MySQL version
drop index a on bar;
ERROR 42000: Table 'bar' uses an extension that doesn't exist in this MySQL version
set session tokudb_disable_slow_alter=OFF;
insert into bar values (1),(2),(3);
alter table bar add column b int default 1 first;
select * from bar;
b a
1 1
1 2
1 3
create index blah on bar (b);
select sum(b) from bar;
sum(b)
3
drop index a on bar;
drop table bar;
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
SET STORAGE_ENGINE = 'tokudb';
set session transaction isolation level repeatable read;
set session tokudb_disable_slow_alter=ON;
# Establish connection conn1 (user = root)
DROP TABLE IF EXISTS foo,bar;
set session transaction isolation level repeatable read;
create table foo (a int, b int) engine=TokuDB;
create table bar (a int) engine=TokuDB;
insert into foo values (1,10),(2,20),(3,30);
begin;
select * from bar;
a
delete from foo;
select * from foo;
a b
alter table foo add column c int first;
alter table foo drop column b;
commit;
set session transaction isolation level serializable;
DROP TABLE foo,bar;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
drop procedure if exists p0;
drop procedure if exists p1;
drop function if exists f0;
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b int, c int, clustering key (b))engine=TokuDB;
insert into foo values (1,10,100),(2,20,200),(3,30,300);
set autocommit=off;
insert into foo values (4,40,400);
alter table foo add column z int default 999 first;
explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4
select * from foo;
z a b c
999 1 10 100
999 2 20 200
999 3 30 300
999 4 40 400
explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where
select* from foo where b > 10;
z a b c
999 2 20 200
999 3 30 300
999 4 40 400
set autocommit=on;
begin;
alter table foo drop column z;
explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4
select * from foo;
a b c
1 10 100
2 20 200
3 30 300
4 40 400
explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where
select* from foo where b > 10;
a b c
2 20 200
3 30 300
4 40 400
lock tables foo write;
alter table foo add column z int;
explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4
select * from foo;
a b c z
1 10 100 NULL
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where
select* from foo where b > 10;
a b c z
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
unlock tables;
select * from foo;
a b c z
1 10 100 NULL
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
select * from foo where b > 10;
a b c z
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
create procedure p0()
begin
alter table foo drop column z;
explain select * from foo;
select * from foo;
explain select * from foo where b > 20;
select* from foo where b > 10;
end |
call p0();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4
a b c
1 10 100
2 20 200
3 30 300
4 40 400
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where
a b c
2 20 200
3 30 300
4 40 400
explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4
select * from foo;
a b c
1 10 100
2 20 200
3 30 300
4 40 400
explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where
select* from foo where b > 10;
a b c
2 20 200
3 30 300
4 40 400
create function f0() returns int
begin
alter table foo add column ggg int;
end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
set autocommit=0;
create procedure p1()
begin
insert into foo values(5,50,500);
select * from foo;
savepoint x;
alter table foo add column g int;
explain select * from foo;
select * from foo;
select * from foo where b > 10;
explain select * from foo where b > 20;
end|
call p1();
a b c
1 10 100
2 20 200
3 30 300
4 40 400
5 50 500
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 5
a b c g
1 10 100 NULL
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
5 50 500 NULL
a b c g
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
5 50 500 NULL
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 3 Using where
set autocommit=on;
explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 5
select * from foo;
a b c g
1 10 100 NULL
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
5 50 500 NULL
explain select * from foo where b > 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 4 Using where
select * from foo where b > 10;
a b c g
2 20 200 NULL
3 30 300 NULL
4 40 400 NULL
5 50 500 NULL
drop table foo;
drop procedure p0;
drop procedure p1;
SET STORAGE_ENGINE = 'tokudb';
set session transaction isolation level repeatable read;
set session tokudb_disable_slow_alter=ON;
# Establish connection conn1 (user = root)
DROP TABLE IF EXISTS foo;
set session transaction isolation level repeatable read;
create table foo (a int, b int) engine=TokuDB;
insert into foo values (1,10);
begin;
select * from foo;
a b
1 10
alter table foo add column c int;
alter table foo drop column b;
commit;
begin;
insert into foo values (1,10);
alter table foo add column cc int;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
alter table foo drop column c;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
set session transaction isolation level serializable;
DROP TABLE foo;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b varchar(10), c blob)engine=TokuDB;
insert into foo values(1,"bb","cccc");
alter table foo change a aa int, change b bb varchar(10);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change b bb varchar(11);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change a aa bigint;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change a aa int NOT NULL;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change a aa int, alter column b drop default;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change b bb varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change c cc mediumblob;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change a aa int, add column d int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change a aa int, drop column c;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change a aa int, add index (b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add index(b);
alter table foo change a aa int, drop index b;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
`a` int(11) DEFAULT NULL,
`b` varchar(10) DEFAULT NULL,
`c` blob,
KEY `b` (`b`)
) ENGINE=TOKUDB DEFAULT CHARSET=latin1
select * from foo;
a b c
1 bb cccc
alter table foo change a aa int DEFAULT 1000;
drop table foo;
create table foo (a int, b int, c int) engine=TokuDB;
alter table foo change c cc int, change a b int, change b a int first;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
drop table foo;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
set session tokudb_disable_slow_alter=ON;
create table foo (
a1 int,
a2 int unsigned,
a3 tinyint,
a4 tinyint unsigned,
a5 bit,
a6 smallint,
a7 smallint unsigned,
a8 mediumint,
a9 mediumint unsigned,
a10 bigint,
a11 bigint unsigned,
a12 double,
a13 double unsigned,
a14 float,
a15 float unsigned,
a16 decimal,
a17 date,
a18 datetime,
a19 timestamp,
a20 time,
a21 year,
a22 binary(100),
a23 varbinary(100),
a24 varchar(10),
a25 varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs,
a26 char(10),
a27 char(10) CHARACTER SET latin1 COLLATE latin1_general_cs,
a28 ENUM('a','b','c') CHARACTER SET binary,
a29 tinyblob,
a30 tinytext CHARACTER SET latin1 COLLATE latin1_general_cs,
a31 blob,
a32 text CHARACTER SET latin1 COLLATE latin1_general_cs,
a33 mediumblob,
a34 mediumtext CHARACTER SET latin1 COLLATE latin1_general_cs,
a35 longblob,
a36 longtext CHARACTER SET latin1 COLLATE latin1_general_cs
)engine = TokuDB;
alter table foo change a1 aa1 int;
alter table foo change a2 aa2 int unsigned;
alter table foo change a3 aa3 tinyint;
alter table foo change a4 aa4 tinyint unsigned;
alter table foo change a5 aa5 bit;
alter table foo change a6 aa6 smallint;
alter table foo change a7 aa7 smallint unsigned;
alter table foo change a8 aa8 mediumint;
alter table foo change a9 aa9 mediumint unsigned;
alter table foo change a10 aa10 bigint;
alter table foo change a11 aa11 bigint unsigned;
alter table foo change a12 aa12 double;
alter table foo change a13 aa13 double unsigned;
alter table foo change a14 aa14 float;
alter table foo change a15 aa15 float unsigned;
alter table foo change a16 aa16 decimal;
alter table foo change a17 aa17 date;
alter table foo change a18 aa18 datetime;
alter table foo change a19 aa19 timestamp;
alter table foo change a21 aa21 year;
alter table foo change a23 aa23 varbinary(100);
alter table foo change a24 aa24 varchar(10);
alter table foo change a25 aa25 varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs;
alter table foo change a26 aa26 char(10);
alter table foo change a27 aa27 char(10) CHARACTER SET latin1 COLLATE latin1_general_cs;
alter table foo change a30 aa30 tinytext CHARACTER SET latin1 COLLATE latin1_general_cs;
alter table foo change a32 aa32 text CHARACTER SET latin1 COLLATE latin1_general_cs;
alter table foo change a34 aa34 mediumtext CHARACTER SET latin1 COLLATE latin1_general_cs;
alter table foo change a36 aa36 longtext CHARACTER SET latin1 COLLATE latin1_general_cs;
drop table foo;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b bigint, c char(10), d varchar(10), e text, primary key (a), key(b), clustering key (d))engine=TOkuDB;
insert into foo values (1,10,"cc","dddd","eeeee");
select * from foo;
a b c d e
1 10 cc dddd eeeee
alter table foo change a aa int;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
`aa` int(11) NOT NULL DEFAULT '0',
`b` bigint(20) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(10) DEFAULT NULL,
`e` text,
PRIMARY KEY (`aa`),
KEY `b` (`b`),
CLUSTERING KEY `d` (`d`)
) ENGINE=TOKUDB DEFAULT CHARSET=latin1
select * from foo;
aa b c d e
1 10 cc dddd eeeee
explain select * from foo where aa > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 1 Using where
select * from foo where aa > 0;
aa b c d e
1 10 cc dddd eeeee
alter table foo change b bb bigint;
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
`aa` int(11) NOT NULL DEFAULT '0',
`bb` bigint(20) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(10) DEFAULT NULL,
`e` text,
PRIMARY KEY (`aa`),
KEY `b` (`bb`),
CLUSTERING KEY `d` (`d`)
) ENGINE=TOKUDB DEFAULT CHARSET=latin1
explain select bb from foo FORCE INDEX (b) where bb > 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index b b 9 NULL 1 Using where; Using index
select bb from foo FORCE INDEX (b) where bb > 5;
bb
10
alter table foo change d dd varchar(10);
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
`aa` int(11) NOT NULL DEFAULT '0',
`bb` bigint(20) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`dd` varchar(10) DEFAULT NULL,
`e` text,
PRIMARY KEY (`aa`),
KEY `b` (`bb`),
CLUSTERING KEY `d` (`dd`)
) ENGINE=TOKUDB DEFAULT CHARSET=latin1
explain select * from foo where dd > "d";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range d d 13 NULL 1 Using where
select * from foo where dd > "d";
aa bb c dd e
1 10 cc dddd eeeee
drop table foo;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), clustering key (b))engine=TokuDB;
create table bar (a int) engine=TokuDB;
alter table foo drop primary key;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop primary key, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop primary key, drop column aa;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table bar add primary key (a);
ERROR 42000: Table 'bar' uses an extension that doesn't exist in this MySQL version
alter table bar add primary key (a), add column z int;
ERROR 42000: Table 'bar' uses an extension that doesn't exist in this MySQL version
alter table foo drop primary key, add primary key (b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop primary key, add primary key (b), add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo drop primary key, add primary key (b), drop column aa;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo add fulltext key(b);
ERROR HY000: The used table type doesn't support FULLTEXT indexes
alter table foo add spatial key (aa);
ERROR HY000: The used table type doesn't support SPATIAL indexes
alter table foo alter column cc set default 101010;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc set default NULL;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc drop default;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc set default 101010, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc set default NULL, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc drop default, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc set default 101010, drop column aa;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc set default NULL, drop column aa;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo alter column cc drop default, drop column aa;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aaa int, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column e epk int, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aaa int, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column e epk int, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
`aa` int(11) DEFAULT NULL,
`bb` int(11) DEFAULT NULL,
`cc` int(11) DEFAULT NULL,
`dd` int(11) DEFAULT NULL,
`ee` int(11) DEFAULT NULL,
`a` int(11) DEFAULT NULL,
`b` varchar(20) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
`e` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`e`),
UNIQUE KEY `c` (`c`),
KEY `d` (`d`),
CLUSTERING KEY `b` (`b`)
) ENGINE=TOKUDB DEFAULT CHARSET=latin1
alter table foo change column aa aa int NOT NULL;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa bigint;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa varchar(20);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa int after cc;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa int NOT NULL;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa bigint;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa varchar(20);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa int after cc;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa int NOT NULL, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa bigint, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa varchar(20), add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa int after cc, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa int NOT NULL, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa bigint, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa varchar(20), add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa int after cc, add column z int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa int NOT NULL, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa bigint, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa varchar(20), drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo change column aa aa int after cc, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa int NOT NULL, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa bigint, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa varchar(20), drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
alter table foo modify column aa int after cc, drop column bb;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
drop table foo;
drop table bar;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar, foo_isam, bar_isam;
set session tokudb_disable_slow_alter=OFF;
create table foo (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), clustering key (b))engine=TokuDB;
create table foo_isam like foo;
alter table foo_isam engine=MyISAM;
create table bar (a int) engine=TokuDB;
create table bar_isam like bar;
alter table bar_isam engine=MyISAM;
insert into foo values (1,10,100,1000,10000,1,"bb",10,100,1000);
insert into foo values (2,20,200,2000,20000,2,"bbb",20,200,2000);
insert into foo values (3,30,300,3000,30000,3,"bbbb",30,300,3000);
insert into foo_isam select * from foo;
alter table foo drop primary key;
alter table foo_isam drop primary key;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo add primary key (e);
alter table foo_isam add primary key (e);
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo drop primary key, add primary key(a);
alter table foo_isam drop primary key, add primary key (a);
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo add fulltext key(b);
ERROR HY000: The used table type doesn't support FULLTEXT indexes
alter table foo add spatial key (aa);
ERROR HY000: The used table type doesn't support SPATIAL indexes
alter table foo alter column cc set default 101010;
alter table foo_isam alter column cc set default 101010;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo alter column cc set default NULL;
alter table foo_isam alter column cc set default NULL;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo alter column cc drop default;
alter table foo_isam alter column cc drop default;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo change column aa aaa int;
alter table foo_isam change column aa aaa int;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo change column aaa aa int;
alter table foo_isam change column aaa aa int;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo change column e epk int;
alter table foo_isam change column e epk int;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo change column epk e int;
alter table foo_isam change column epk e int;
include/diff_tables.inc [test.foo, test.foo_isam]
show create table foo;
Table Create Table
foo CREATE TABLE `foo` (
`aa` int(11) DEFAULT NULL,
`bb` int(11) DEFAULT NULL,
`cc` int(11),
`dd` int(11) DEFAULT NULL,
`ee` int(11) DEFAULT NULL,
`a` int(11) NOT NULL DEFAULT '0',
`b` varchar(20) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
`e` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `c` (`c`),
KEY `d` (`d`),
CLUSTERING KEY `b` (`b`)
) ENGINE=TOKUDB DEFAULT CHARSET=latin1
show create table foo_isam;
Table Create Table
foo_isam CREATE TABLE `foo_isam` (
`aa` int(11) DEFAULT NULL,
`bb` int(11) DEFAULT NULL,
`cc` int(11),
`dd` int(11) DEFAULT NULL,
`ee` int(11) DEFAULT NULL,
`a` int(11) NOT NULL DEFAULT '0',
`b` varchar(20) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) DEFAULT NULL,
`e` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `c` (`c`),
KEY `d` (`d`),
CLUSTERING KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table foo change column aa aa int NOT NULL;
alter table foo_isam change column aa aa int NOT NULL;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo change column aa aa bigint;
alter table foo_isam change column aa aa bigint;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo change column aa aa varchar(20);
alter table foo_isam change column aa aa varchar(20);
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo change column aa aa int after cc;
alter table foo_isam change column aa aa int after cc;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo modify column aa int NOT NULL;
alter table foo_isam modify column aa int NOT NULL;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo modify column aa bigint;
alter table foo_isam modify column aa bigint;
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo modify column aa varchar(20);
alter table foo_isam modify column aa varchar(20);
include/diff_tables.inc [test.foo, test.foo_isam]
alter table foo modify column aa int after cc;
alter table foo_isam modify column aa int after cc;
include/diff_tables.inc [test.foo, test.foo_isam]
drop table foo;
drop table bar;
drop table foo_isam;
drop table bar_isam;
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b int, c int, d int as (a mod 10) virtual, key(a))engine=TokuDB;
ERROR HY000: TokuDB storage engine does not support computed columns
create table foo (a int, b int, c int)engine=TokuDB;
alter table foo add column d int as (a mod 10) virtual;
ERROR HY000: TokuDB storage engine does not support computed columns
alter table foo add column d int as (a mod 10) persistent;
ERROR HY000: TokuDB storage engine does not support computed columns
drop table foo;
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b int, c int, key(a))engine=TokuDB;
insert into foo values (1,10,100),(2,20,200),(3,30,300),(3,30,300);
select * from foo;
explain select sum(a) from foo;
select sum(a) from foo;
--error ER_DUP_KEY
alter table foo add unique index b(b), drop index a;
select * from foo;
explain select sum(a) from foo;
select sum(a) from foo;
--echo #test that we can still add an index named 'b'
alter table foo add index b(b);
explain select sum(b) from foo;
select sum(b) from foo;
set autocommit=0;
drop index b on foo;
create index b on foo (b);
explain select sum(b) from foo;
select sum(b) from foo;
set autocommit=1;
drop table foo;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
select * from foo order by b desc;
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
select * from foo order by b desc;
drop table foo;
drop table bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
select * from foo order by b desc;
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
select * from foo order by b desc;
drop table foo;
drop table bar;
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
select * from foo order by b desc;
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
select * from foo order by b desc;
drop table foo;
drop table bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
select * from foo order by b desc;
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
select * from foo order by b desc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
select * from foo order by b desc;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
select * from foo order by b desc;
drop table foo;
drop table bar;
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
create table foo(a varchar(10), b varchar (10), c varchar(10), d varchar(10))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL,NULL,NULL,NULL);
insert into foo values (NULL, "bobby",NULL,"heehee");
insert into foo values ("BIGGER",NULL,"smaller",NULL);
insert into foo values ("aaaaaaaaaa","bbbbbbbbbb","cccccccccc","dddddddddd");
insert into bar select * from foo;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) default NULL;
alter table bar add column e varchar(3000) default NULL;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) default NULL first;
alter table bar add column e varchar(3000) default NULL first;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) default NULL after b;
alter table bar add column e varchar(3000) default NULL after b;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) default "abracadabraabracadabra";
alter table bar add column e varchar(3000) default "abracadabraabracadabra";
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) default "abracadabraabracadabra" first;
alter table bar add column e varchar(3000) default "abracadabraabracadabra" first;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) default "abracadabraabracadabra" after b;
alter table bar add column e varchar(3000) default "abracadabraabracadabra" after b;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) default NULL after b;
alter table bar add column e varchar(3000) default NULL after b;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) NOT NULL default "abracadabraabracadabra";
alter table bar add column e varchar(3000) NOT NULL default "abracadabraabracadabra";
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) NOT NULL default "abracadabraabracadabra" first;
alter table bar add column e varchar(3000) NOT NULL default "abracadabraabracadabra" first;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e varchar(3000) NOT NULL default "abracadabraabracadabra" after b;
alter table bar add column e varchar(3000) NOT NULL default "abracadabraabracadabra" after b;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
drop table foo;
drop table bar;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
create table foo (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), clustering key (b))engine=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column e;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column d;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column c;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column b;
alter table foo add column aaa int first;
alter table foo drop column aaa;
alter table foo add column aaa int first;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, drop index d;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, add index (bb);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop index b, add index b(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, drop index b, add index b(d);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, drop index b, add index b(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, drop index b, add clustering index b(b(5));
# successfully drop it
alter table foo drop column aaa, drop index b, add clustering index b(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index d;
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, add index (bb);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index b, add index b(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index b, add index b(d);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index b, add unique index b(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index b, add index b(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index b, add clustering index b(b(5));
# successfully add it
alter table foo add column aaa int, drop index b, add clustering index b(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, drop index c;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, add index (bb);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop index c, add index c(c);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, drop index c, add index c(d);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column aaa, drop index c, add index c(c);
# successfully drop it
alter table foo drop column aaa, drop index c, add unique index c(c);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index c;
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, add index (bb);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index c, add index c(c);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index c, add index c(d);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index c, add clustering index c(c);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaa int, drop index c, add index c(c);
# successfully add it
alter table foo add column aaa int, drop index c, add unique index c(c);
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaaa int, drop column c;
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaaa int, add column bbbb int, drop column c;
--error ER_UNSUPPORTED_EXTENSION
alter table foo add column aaaa int, drop column c, drop column b;
drop table foo;
\ No newline at end of file
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
# test adding the first null bit to a table
create table foo (a int NOT NULL, b bigint NOT NULL, c tinyint NOT NULL, d int NOT NULL, primary key (b))engine=TokuDB;
insert into foo values (122,10,1,1000),(1,110,1,0),(0,3234,0,657),(0,0,0,0),(99,99,0,99), (-1,-1,-1,-1);
create table bar like foo;
alter table bar engine=MyISAM;
insert into bar select * from foo;
source include/diff_tables.inc;
alter table foo add column e int default NULL first;
alter table bar add column e int default NULL first;
select * from foo;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e int default -1 first;
alter table bar add column e int default -1 first;
source include/diff_tables.inc;
alter table foo drop column e;
alter table bar drop column e;
source include/diff_tables.inc;
alter table foo add column e int NOT NULL default -1 first;
alter table bar add column e int NOT NULL default -1 first;
source include/diff_tables.inc;
select * from foo;
drop table foo; drop table bar;
########################### some simple tests ###############
create table foo (a int, b int not null, c int, d int not null, e int, primary key (e))engine=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column e;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL, -1, NULL, -1,1),(0,0,0,0,0),(NULL,234,234,324,234),(98567,76,NULL,7668,90909);
insert into bar select * from foo;
source include/diff_tables.inc;
alter table foo drop column b;
alter table bar drop column b;
source include/diff_tables.inc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
alter table foo drop column a;
alter table bar drop column a;
source include/diff_tables.inc;
drop table foo; drop table bar;
create table foo (a varchar(20), b varchar(20) not null, c varchar(20), d varchar(20) not null, e int, primary key (e))engine=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop column e;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL, "-1", NULL, "-1",1),("dfg0","0rrr","eee0","qwert",0),(NULL,"234","234","324",234),("98567","76",NULL,"7668","90909");
insert into bar select * from foo;
source include/diff_tables.inc;
alter table foo drop column b;
alter table bar drop column b;
source include/diff_tables.inc;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
alter table foo drop column a;
alter table bar drop column a;
source include/diff_tables.inc;
drop table foo; drop table bar;
create table foo(
a int,
b int,
c int,
d int,
e int,
f int,
g int,
h int,
aa int,
bb int,
cc int,
dd int
)engine = TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1);
insert into foo values (-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL,-1,NULL);
insert into foo values (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
insert into foo values (-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
insert into bar select * from foo;
source include/diff_tables.inc;
select * from foo;
alter table foo drop column a, drop column aa, drop column c, drop column cc, drop column e, drop column f;
alter table bar drop column a, drop column aa, drop column c, drop column cc, drop column e, drop column f;
source include/diff_tables.inc;
select * from foo;
alter table foo add column a int default -1 first, add column aa int NOT NULL default -1 after h, add column c int default NULL after b, add column cc int default 0 after bb, add column f int default NULL after d, add column e int NOT NULL default 12345 after d;
alter table bar add column a int default -1 first, add column aa int NOT NULL default -1 after h, add column c int default NULL after b, add column cc int default 0 after bb, add column f int default NULL after d, add column e int NOT NULL default 12345 after d;
source include/diff_tables.inc;
select * from foo;
drop table foo; drop table bar;
\ No newline at end of file
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
source include/diff_tables.inc;
select * from foo;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
source include/diff_tables.inc;
select * from foo;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
drop table foo;
drop table bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
alter table bar add column d int default 20;
source include/diff_tables.inc;
select * from foo;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
alter table foo add column d int default 20 first;
alter table bar add column d int default 20 first;
source include/diff_tables.inc;
select * from foo;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
drop table foo;
drop table bar;
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
source include/diff_tables.inc;
select * from foo;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
source include/diff_tables.inc;
select * from foo;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
drop table foo;
drop table bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
alter table bar add column d varchar(10) default 20;
source include/diff_tables.inc;
select * from foo;
insert into foo values (3,30,300,3000);
insert into bar values (3,30,300,3000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (4,40,400);
insert into bar values (4,40,400);
select * from foo;
alter table foo add column d varchar(10) default 20 first;
alter table bar add column d varchar(10) default 20 first;
source include/diff_tables.inc;
select * from foo;
insert into foo values (5,50,500,5000);
insert into bar values (5,50,500,5000);
select * from foo;
alter table foo drop column d;
alter table bar drop column d;
source include/diff_tables.inc;
select * from foo;
insert into foo values (6,60,600);
insert into bar values (6,60,600);
select * from foo;
drop table foo;
drop table bar;
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
#drop table foo;
\ No newline at end of file
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
create temporary table bar (a int, key(a))engine=TOkuDB;
--error ER_UNSUPPORTED_EXTENSION
alter table bar add column c int;
--error ER_UNSUPPORTED_EXTENSION
create index blah on bar(a);
--error ER_UNSUPPORTED_EXTENSION
drop index a on bar;
set session tokudb_disable_slow_alter=OFF;
insert into bar values (1),(2),(3);
alter table bar add column b int default 1 first;
select * from bar;
create index blah on bar (b);
select sum(b) from bar;
drop index a on bar;
drop table bar;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# test simple MVCC, that a transaction does not read something committed after it
#--source include/have_tokudb.inc
SET STORAGE_ENGINE = 'tokudb';
set session transaction isolation level repeatable read;
set session tokudb_disable_slow_alter=ON;
--echo # Establish connection conn1 (user = root)
connect (conn1,localhost,root,,);
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
connection conn1;
set session transaction isolation level repeatable read;
create table foo (a int, b int) engine=TokuDB;
create table bar (a int) engine=TokuDB;
insert into foo values (1,10),(2,20),(3,30);
begin;
select * from bar;
connection default;
delete from foo;
select * from foo;
alter table foo add column c int first;
alter table foo drop column b;
connection conn1;
commit;
connection default;
disconnect conn1;
connection default;
# Final cleanup.
set session transaction isolation level serializable;
DROP TABLE foo,bar;
\ No newline at end of file
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
drop procedure if exists p0;
drop procedure if exists p1;
drop function if exists f0;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b int, c int, clustering key (b))engine=TokuDB;
insert into foo values (1,10,100),(2,20,200),(3,30,300);
#test that alter table works with autocommit off;
set autocommit=off;
insert into foo values (4,40,400);
alter table foo add column z int default 999 first;
explain select * from foo;
select * from foo;
explain select * from foo where b > 20;
select* from foo where b > 10;
set autocommit=on;
#test that alter table works with autocommit off;
begin;
alter table foo drop column z;
explain select * from foo;
select * from foo;
explain select * from foo where b > 20;
select* from foo where b > 10;
#simple test with lock tables
lock tables foo write;
alter table foo add column z int;
explain select * from foo;
select * from foo;
explain select * from foo where b > 20;
select* from foo where b > 10;
unlock tables;
select * from foo;
select * from foo where b > 10;
delimiter |;
create procedure p0()
begin
alter table foo drop column z;
explain select * from foo;
select * from foo;
explain select * from foo where b > 20;
select* from foo where b > 10;
end |
delimiter ;|
call p0();
explain select * from foo;
select * from foo;
explain select * from foo where b > 20;
select* from foo where b > 10;
delimiter |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function f0() returns int
begin
alter table foo add column ggg int;
end|
delimiter ;|
set autocommit=0;
delimiter |;
create procedure p1()
begin
insert into foo values(5,50,500);
select * from foo;
savepoint x;
alter table foo add column g int;
explain select * from foo;
select * from foo;
select * from foo where b > 10;
explain select * from foo where b > 20;
end|
delimiter ;|
call p1();
set autocommit=on;
explain select * from foo;
select * from foo;
explain select * from foo where b > 10;
select * from foo where b > 10;
drop table foo;
drop procedure p0;
drop procedure p1;
\ No newline at end of file
# test simple MVCC, that a transaction does not read something committed after it
#--source include/have_tokudb.inc
SET STORAGE_ENGINE = 'tokudb';
set session transaction isolation level repeatable read;
set session tokudb_disable_slow_alter=ON;
--echo # Establish connection conn1 (user = root)
connect (conn1,localhost,root,,);
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
connection conn1;
set session transaction isolation level repeatable read;
create table foo (a int, b int) engine=TokuDB;
insert into foo values (1,10);
begin;
select * from foo;
connection default;
alter table foo add column c int;
alter table foo drop column b;
connection conn1;
commit;
begin;
insert into foo values (1,10);
connection default;
--error ER_LOCK_WAIT_TIMEOUT
alter table foo add column cc int;
--error ER_LOCK_WAIT_TIMEOUT
alter table foo drop column c;
connection conn1;
commit;
connection default;
disconnect conn1;
connection default;
# Final cleanup.
set session transaction isolation level serializable;
DROP TABLE foo;
\ No newline at end of file
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
# test that modifying a column with more than just a rename is not fast
create table foo (a int, b varchar(10), c blob)engine=TokuDB;
insert into foo values(1,"bb","cccc");
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int, change b bb varchar(10);
--error ER_UNSUPPORTED_EXTENSION
alter table foo change b bb varchar(11);
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa bigint;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int, alter column b drop default;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change b bb varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change c cc mediumblob;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int, add column d int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int, drop column c;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int, add index (b);
alter table foo add index(b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int, drop index b;
show create table foo;
select * from foo;
#--error ER_UNSUPPORTED_EXTENSION
alter table foo change a aa int DEFAULT 1000;
drop table foo;
create table foo (a int, b int, c int) engine=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change c cc int, change a b int, change b a int first;
drop table foo;
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
create table foo (
a1 int,
a2 int unsigned,
a3 tinyint,
a4 tinyint unsigned,
a5 bit,
a6 smallint,
a7 smallint unsigned,
a8 mediumint,
a9 mediumint unsigned,
a10 bigint,
a11 bigint unsigned,
a12 double,
a13 double unsigned,
a14 float,
a15 float unsigned,
a16 decimal,
a17 date,
a18 datetime,
a19 timestamp,
a20 time,
a21 year,
a22 binary(100),
a23 varbinary(100),
a24 varchar(10),
a25 varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs,
a26 char(10),
a27 char(10) CHARACTER SET latin1 COLLATE latin1_general_cs,
a28 ENUM('a','b','c') CHARACTER SET binary,
a29 tinyblob,
a30 tinytext CHARACTER SET latin1 COLLATE latin1_general_cs,
a31 blob,
a32 text CHARACTER SET latin1 COLLATE latin1_general_cs,
a33 mediumblob,
a34 mediumtext CHARACTER SET latin1 COLLATE latin1_general_cs,
a35 longblob,
a36 longtext CHARACTER SET latin1 COLLATE latin1_general_cs
)engine = TokuDB;
alter table foo change a1 aa1 int;
alter table foo change a2 aa2 int unsigned;
alter table foo change a3 aa3 tinyint;
alter table foo change a4 aa4 tinyint unsigned;
alter table foo change a5 aa5 bit;
alter table foo change a6 aa6 smallint;
alter table foo change a7 aa7 smallint unsigned;
alter table foo change a8 aa8 mediumint;
alter table foo change a9 aa9 mediumint unsigned;
alter table foo change a10 aa10 bigint;
alter table foo change a11 aa11 bigint unsigned;
alter table foo change a12 aa12 double;
alter table foo change a13 aa13 double unsigned;
alter table foo change a14 aa14 float;
alter table foo change a15 aa15 float unsigned;
alter table foo change a16 aa16 decimal;
alter table foo change a17 aa17 date;
alter table foo change a18 aa18 datetime;
alter table foo change a19 aa19 timestamp;
#alter table foo change a20 aa20 time;
alter table foo change a21 aa21 year;
#alter table foo change a22 aa22 binary(100);
alter table foo change a23 aa23 varbinary(100);
alter table foo change a24 aa24 varchar(10);
alter table foo change a25 aa25 varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs;
alter table foo change a26 aa26 char(10);
alter table foo change a27 aa27 char(10) CHARACTER SET latin1 COLLATE latin1_general_cs;
#alter table foo change a28 aa28 ENUM('a','b','c') CHARACTER SET binary;
#alter table foo change a29 aa29 tinyblob;
alter table foo change a30 aa30 tinytext CHARACTER SET latin1 COLLATE latin1_general_cs;
#alter table foo change a31 aa31 blob;
alter table foo change a32 aa32 text CHARACTER SET latin1 COLLATE latin1_general_cs;
#alter table foo change a33 aa33 mediumblob;
alter table foo change a34 aa34 mediumtext CHARACTER SET latin1 COLLATE latin1_general_cs;
#alter table foo change a35 aa35 longblob;
alter table foo change a36 aa36 longtext CHARACTER SET latin1 COLLATE latin1_general_cs;
drop table foo;
\ No newline at end of file
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
create table foo (a int, b bigint, c char(10), d varchar(10), e text, primary key (a), key(b), clustering key (d))engine=TOkuDB;
insert into foo values (1,10,"cc","dddd","eeeee");
select * from foo;
alter table foo change a aa int;
show create table foo;
select * from foo;
explain select * from foo where aa > 0;
select * from foo where aa > 0;
alter table foo change b bb bigint;
show create table foo;
explain select bb from foo FORCE INDEX (b) where bb > 5;
select bb from foo FORCE INDEX (b) where bb > 5;
alter table foo change d dd varchar(10);
show create table foo;
explain select * from foo where dd > "d";
select * from foo where dd > "d";
drop table foo;
\ No newline at end of file
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
create table foo (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), clustering key (b))engine=TokuDB;
create table bar (a int) engine=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop primary key;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop primary key, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop primary key, drop column aa;
--error ER_UNSUPPORTED_EXTENSION
alter table bar add primary key (a);
--error ER_UNSUPPORTED_EXTENSION
alter table bar add primary key (a), add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop primary key, add primary key (b);
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop primary key, add primary key (b), add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo drop primary key, add primary key (b), drop column aa;
--error ER_TABLE_CANT_HANDLE_FT
alter table foo add fulltext key(b);
--error ER_TABLE_CANT_HANDLE_SPKEYS
alter table foo add spatial key (aa);
# Supporting these should be trivial
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc set default 101010;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc set default NULL;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc drop default;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc set default 101010, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc set default NULL, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc drop default, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc set default 101010, drop column aa;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc set default NULL, drop column aa;
--error ER_UNSUPPORTED_EXTENSION
alter table foo alter column cc drop default, drop column aa;
# these one day MAY be supported
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aaa int, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column e epk int, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aaa int, drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column e epk int, drop column bb;
show create table foo;
# the following changes of a column should be slow
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa int NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa bigint;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa varchar(20);
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa int after cc;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa int NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa bigint;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa varchar(20);
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa int after cc;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa int NOT NULL, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa bigint, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa varchar(20), add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa int after cc, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa int NOT NULL, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa bigint, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa varchar(20), add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa int after cc, add column z int;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa int NOT NULL, drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa bigint, drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa varchar(20), drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo change column aa aa int after cc, drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa int NOT NULL, drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa bigint, drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa varchar(20), drop column bb;
--error ER_UNSUPPORTED_EXTENSION
alter table foo modify column aa int after cc, drop column bb;
drop table foo;
drop table bar;
This diff is collapsed.
#--source include/have_tokudb.inc
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
--error ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS
create table foo (a int, b int, c int, d int as (a mod 10) virtual, key(a))engine=TokuDB;
create table foo (a int, b int, c int)engine=TokuDB;
--error ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS
alter table foo add column d int as (a mod 10) virtual;
--error ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS
alter table foo add column d int as (a mod 10) persistent;
drop table foo;
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