~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
--source include/have_symlink.inc
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
2
#--source include/not_windows.inc
1 by brian
clean slate
3
4
--disable_warnings
5
drop table if exists t1,t2,t7,t8,t9;
6
drop database if exists mysqltest;
7
--enable_warnings
8
9
#
10
# First create little data to play with
11
#
12
13
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
14
create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
15
insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
16
insert into t2 (b) select b from t1;
17
insert into t1 (b) select b from t2;
18
insert into t2 (b) select b from t1;
19
insert into t1 (b) select b from t2;
20
insert into t2 (b) select b from t1;
21
insert into t1 (b) select b from t2;
22
insert into t2 (b) select b from t1;
23
insert into t1 (b) select b from t2;
24
insert into t2 (b) select b from t1;
25
insert into t1 (b) select b from t2;
26
insert into t2 (b) select b from t1;
27
insert into t1 (b) select b from t2;
28
insert into t2 (b) select b from t1;
29
insert into t1 (b) select b from t2;
30
insert into t2 (b) select b from t1;
31
insert into t1 (b) select b from t2;
32
insert into t2 (b) select b from t1;
33
insert into t1 (b) select b from t2;
34
drop table t2;
35
36
#
37
# Start the test
38
# We use t9 here to not crash with tables generated by the backup test
39
# 
40
41
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
42
eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQLTEST_VARDIR/tmp" index directory="$MYSQLTEST_VARDIR/run";
43
44
insert into t9 select * from t1;
45
check table t9;
46
optimize table t9;
789 by Brian Aker
MyISAM fix.
47
SET GLOBAL myisam_sort_buffer_size=1024;
1 by brian
clean slate
48
repair table t9;
49
alter table t9 add column c int not null;
50
51
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
52
show create table t9;
53
54
# Test renames
55
alter table t9 rename t8, add column d int not null;
56
alter table t8 rename t7;
57
rename table t7 to t9;
58
# Drop old t1 table, keep t9
59
drop table t1;
60
61
#
62
# Test error handling
63
# Note that we are using the above table t9 here!
64
#
65
66
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
67
SHOW CREATE TABLE t9;
68
69
--error 1103,1103
70
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
71
72
# Check that we cannot link over a table from another database.
73
74
create database mysqltest;
75
76
--error 1,1
77
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
78
79
--error 1103,1103
80
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
81
82
# Should fail becasue the file t9.MYI already exist in 'run'
83
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
84
--error 1,1,1105
85
eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="$MYSQLTEST_VARDIR/run";
86
87
# Should fail becasue the file t9.MYD already exist in 'tmp'
88
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
89
--error 1,1,ER_TABLE_EXISTS_ERROR
90
eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQLTEST_VARDIR/tmp";
91
92
# Check moving table t9 from default database to mysqltest;
93
# In this case the symlinks should be removed.
94
95
alter table t9 rename mysqltest.t9;
96
select count(*) from mysqltest.t9;
97
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
98
show create table mysqltest.t9;
99
drop database mysqltest;
100
101
#
102
# Test changing data dir (Bug #1662)
103
#
104
105
create table t1 (a int not null) engine=myisam;
106
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
107
eval alter table t1 data directory="$MYSQLTEST_VARDIR/tmp";
108
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
109
show create table t1;
110
alter table t1 add b int;
111
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
112
eval alter table t1 data directory="$MYSQLTEST_VARDIR/log";
113
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
114
show create table t1;
115
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
116
eval alter table t1 index directory="$MYSQLTEST_VARDIR/log";
117
show create table t1;
118
drop table t1;
119
120
#
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
121
# BUG#32111 - Security Breach via DATA/INDEX DIRECTORY and RENAME TABLE
1 by brian
clean slate
122
#
123
--write_file $MYSQLTEST_VARDIR/tmp/t1.MYI
124
EOF
125
--replace_result $MYSQLTEST_VARDIR TEST_DIR $MYSQLTEST_VARDIR TEST_DIR
126
--error 1,1
127
eval CREATE TABLE t1(a INT)
128
DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
129
INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp' ENGINE=MyISAM;
1 by brian
clean slate
130
--replace_result $MYSQLTEST_VARDIR TEST_DIR
131
eval CREATE TABLE t2(a INT)
132
DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
133
INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp' ENGINE=MyISAM;
1 by brian
clean slate
134
--replace_result $MYSQLTEST_VARDIR TEST_DIR
135
--error 1
136
RENAME TABLE t2 TO t1;
137
DROP TABLE t2;
138
--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI
139
140
#
141
# Bug#8706 - temporary table with data directory option fails
142
#
143
connect (session1,localhost,root,,);
144
connect (session2,localhost,root,,);
145
146
connection session1;
147
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
148
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 9 a;
149
# If running test suite with a non standard tmp dir, the "show create table"
150
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
151
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
152
show create table t1;
153
154
connection session2;
155
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
156
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 99 a;
157
# If running test suite with a non standard tmp dir, the "show create table"
158
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
159
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
160
show create table t1;
161
162
connection default;
642.1.53 by Lee
enable subselect_not, subselect_no_mat and variables tests, some other misc clean up on other tests
163
create table t1 (a int) engine=myisam select 42 a;
1 by brian
clean slate
164
642.1.53 by Lee
enable subselect_not, subselect_no_mat and variables tests, some other misc clean up on other tests
165
connection session1;
166
select * from t1;
167
disconnect session1;
168
connection session2;
169
select * from t1;
170
disconnect session2;
171
connection default;
172
select * from t1;
173
drop table t1;
1 by brian
clean slate
174
175
--echo End of 4.1 tests
176
177
#
178
# Bug #29325: create table overwrites .MYD file of other table (datadir)
179
#
180
SET SESSION keep_files_on_create = TRUE;
181
--write_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
182
EOF
183
--disable_abort_on_error
184
--error 1,1,ER_TABLE_EXISTS_ERROR
185
CREATE TABLE t1 (a INT) ENGINE MYISAM;
186
--error 0,1
642.1.53 by Lee
enable subselect_not, subselect_no_mat and variables tests, some other misc clean up on other tests
187
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
1 by brian
clean slate
188
--enable_abort_on_error
189
SET SESSION keep_files_on_create = FALSE;
190
CREATE TABLE t1 (a INT) ENGINE MYISAM;
191
DROP TABLE t1;
192
193
--echo End of 5.0 tests
194
195
#
196
# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
197
#
198
--replace_result $MYSQLTEST_VARDIR TEST_DIR
199
--error 1210
200
eval CREATE TABLE t1(a INT)
201
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
202
--replace_result $MYSQLTEST_VARDIR TEST_DIR
203
--error 1210
204
eval CREATE TABLE t1(a INT)
205
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test';
206
--replace_result $MYSQLTEST_VARDIR TEST_DIR
207
--error 1210
208
eval CREATE TABLE t1(a INT)
209
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/';
210
--replace_result $MYSQLTEST_VARDIR TEST_DIR
211
--error 1210
212
eval CREATE TABLE t1(a INT)
213
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data';
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
214
1 by brian
clean slate
215
--replace_result $MYSQLTEST_VARDIR TEST_DIR
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
216
# Bug 311013 - specifying not existent directory does not give an error
217
#--error 1
218
#eval CREATE TABLE t1(a INT)
219
#INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var';
220
1 by brian
clean slate
221
# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
222
#             silently ignored
223
#
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
224
# sql_mode not supported in Drizzle
225
#SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
1 by brian
clean slate
226
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
227
eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
228
DROP TABLE t1;
642.1.51 by Lee
enable user_var, user_var-binlog and symlink tests
229
#SET @@SQL_MODE=@OLD_SQL_MODE;
1 by brian
clean slate
230
231
--echo End of 5.1 tests
789 by Brian Aker
MyISAM fix.
232
SET GLOBAL myisam_sort_buffer_size=DEFAULT;