File: other_alter2.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 (100 lines) | stat: -rw-r--r-- 3,604 bytes parent folder | download | duplicates (7)
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
--source include/have_tokudb.inc
SET DEFAULT_STORAGE_ENGINE='tokudb';

--disable_warnings
DROP TABLE IF EXISTS foo,bar, foo_isam, bar_isam;
--enable_warnings

set session tokudb_disable_slow_alter=OFF;
let $diff_tables= test.foo, test.foo_isam;

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), key (b) clustering=yes)engine=TokuDB;
create table foo_isam (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), key (b))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;
source include/diff_tables.inc;
alter table foo add primary key (e);
alter table foo_isam add primary key (e);
source include/diff_tables.inc;
alter table foo drop primary key, add primary key(a);
alter table foo_isam drop primary key, add primary key (a);
source include/diff_tables.inc;

--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
alter table foo alter column cc set default 101010;
alter table foo_isam alter column cc set default 101010;
source include/diff_tables.inc;
alter table foo alter column cc set default NULL;
alter table foo_isam alter column cc set default NULL;
source include/diff_tables.inc;
alter table foo alter column cc drop default;
alter table foo_isam alter column cc drop default;
source include/diff_tables.inc;


alter table foo change column aa aaa int;
alter table foo_isam change column aa aaa int;
source include/diff_tables.inc;
alter table foo change column aaa aa int;
alter table foo_isam change column aaa aa int;
source include/diff_tables.inc;


alter table foo change column e epk int;
alter table foo_isam change column e epk int;
source include/diff_tables.inc;
alter table foo change column epk e int;
alter table foo_isam change column epk e int;
source include/diff_tables.inc;

show create table foo;
show create table foo_isam;

# the following changes of a column should be slow
alter table foo change column aa aa int NOT NULL;
alter table foo_isam change column aa aa int NOT NULL;
source include/diff_tables.inc;
alter table foo change column aa aa bigint;
alter table foo_isam change column aa aa bigint;
source include/diff_tables.inc;
alter table foo change column aa aa varchar(20);
alter table foo_isam change column aa aa varchar(20);
source include/diff_tables.inc;
alter table foo change column aa aa int after cc;
alter table foo_isam change column aa aa int after cc;
source include/diff_tables.inc;


alter table foo modify column aa int NOT NULL;
alter table foo_isam modify column aa int NOT NULL;
source include/diff_tables.inc;
alter table foo modify column aa bigint;
alter table foo_isam modify column aa bigint;
source include/diff_tables.inc;
alter table foo modify column aa varchar(20);
alter table foo_isam modify column aa varchar(20);
source include/diff_tables.inc;
alter table foo modify column aa int after cc;
alter table foo_isam modify column aa int after cc;
source include/diff_tables.inc;


drop table foo;
drop table bar;
drop table foo_isam;
drop table bar_isam;