mariadb/mysql-test/suite/tokudb.alter_table/t/hcad_null_bits.test
Rich Prohaska 955ef1b536 refs #5545 baseline mysql alter table tests to mysql 5.5
git-svn-id: file:///svn/mysql/tests/mysql-test@48560 c7de825b-a66e-492c-adef-691d508d4ae1
2012-10-03 17:32:22 +00:00

123 lines
No EOL
4.3 KiB
Text

#--source include/have_tokudb.inc
SET DEFAULT_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;
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--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;
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--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;