File: hcad_null_bits.test

package info (click to toggle)
mariadb-10.0 10.0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 416,512 kB
  • sloc: cpp: 1,351,103; ansic: 803,086; perl: 59,621; pascal: 32,136; sh: 25,156; yacc: 14,897; xml: 5,194; sql: 4,651; cs: 4,647; makefile: 4,113; python: 2,526; ruby: 2,496; lex: 1,427; asm: 295; awk: 54; php: 22; sed: 16
file content (123 lines) | stat: -rw-r--r-- 4,397 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
--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;