~drizzle-trunk/drizzle/development

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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
--source include/have_symlink.inc
#--source include/not_windows.inc

--disable_warnings
drop table if exists t1,t2,t7,t8,t9;
drop database if exists mysqltest;
--enable_warnings

#
# First create little data to play with
#

create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
drop table t2;

#
# Start the test
# We use t9 here to not crash with tables generated by the backup test
# 

--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create temporary 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";

insert into t9 select * from t1;
check table t9;
optimize table t9;
SET GLOBAL myisam_sort_buffer_size=1024;
check table t9;
alter table t9 add column c int not null;

--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t9;

# Test renames
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
# because "rename table t7 to t9" should obviously not support temp tables. GAH
alter table t7 rename t9;
# Drop old t1 table, keep t9
drop table t1;

#
# Test error handling
# Note that we are using the above table t9 here!
#

--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t9;

--error 1103,1103
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";

# Check that we cannot link over a table from another database.

create database mysqltest;

--error 1,1
create temporary 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";

--error 1103,1103
create temporary table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";

# Check moving table t9 from default database to mysqltest;
# In this case the symlinks should be removed.

alter table t9 rename mysqltest.t9;
select count(*) from mysqltest.t9;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table mysqltest.t9;
drop database mysqltest;

#
# Test changing data dir (Bug #1662)
#

create temporary table t1 (a int not null) engine=myisam;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval alter table t1 data directory="$MYSQLTEST_VARDIR/tmp";
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
alter table t1 add b int;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval alter table t1 data directory="$MYSQLTEST_VARDIR/log";
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval alter table t1 index directory="$MYSQLTEST_VARDIR/log";
show create table t1;
drop table t1;

#
# Bug#8706 - temporary table with data directory option fails
#
connect (session1,localhost,root,,);
connect (session2,localhost,root,,);

connection session1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 9 a;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;

connection session2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 99 a;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;

connection default;

--echo End of 4.1 tests

--echo End of 5.0 tests

--replace_result $MYSQLTEST_VARDIR TEST_DIR
# Bug 311013 - specifying not existent directory does not give an error
#--error 1
#eval CREATE TABLE t1(a INT)
#INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var';

# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
#             silently ignored
#
# sql_mode not supported in Drizzle
#SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
DROP TABLE t1;
#SET @@SQL_MODE=@OLD_SQL_MODE;

--echo End of 5.1 tests
SET GLOBAL myisam_sort_buffer_size=DEFAULT;