1
by brian
clean slate |
1 |
# Initialise |
2 |
--disable_warnings
|
|
3 |
drop table if exists t1; |
|
4 |
drop database if exists mysqltest; |
|
5 |
# If earlier test failed |
|
6 |
drop database if exists client_test_db; |
|
7 |
--enable_warnings
|
|
8 |
||
9 |
--error 1051
|
|
10 |
drop table t1; |
|
11 |
create table t1(n int); |
|
12 |
insert into t1 values(1); |
|
13 |
create temporary table t1( n int); |
|
14 |
insert into t1 values(2); |
|
15 |
--error 1050
|
|
16 |
create table t1(n int); |
|
17 |
drop table t1; |
|
18 |
select * from t1; |
|
19 |
||
20 |
# now test for a bug in drop database - it is important that the name |
|
21 |
# of the table is the same as the name of the database - in the original |
|
22 |
# code this triggered a bug |
|
23 |
create database mysqltest; |
|
24 |
drop database if exists mysqltest; |
|
25 |
create database mysqltest; |
|
26 |
create table mysqltest.mysqltest (n int); |
|
27 |
insert into mysqltest.mysqltest values (4); |
|
28 |
select * from mysqltest.mysqltest; |
|
29 |
--enable_info
|
|
30 |
drop database if exists mysqltest; |
|
31 |
--disable_info
|
|
32 |
create database mysqltest; |
|
33 |
||
34 |
#
|
|
35 |
# drop many tables - bug#3891 |
|
36 |
# we'll do it in mysqltest db, to be able to use longer table names |
|
37 |
# (tableN instead on tN) |
|
38 |
#
|
|
39 |
use mysqltest; |
|
40 |
--error 1051
|
|
41 |
drop table table1, table2, table3, table4, table5, table6, |
|
42 |
table7, table8, table9, table10, table11, table12, table13, |
|
43 |
table14, table15, table16, table17, table18, table19, table20, |
|
44 |
table21, table22, table23, table24, table25, table26, table27, |
|
45 |
table28; |
|
46 |
||
47 |
--error 1051
|
|
48 |
drop table table1, table2, table3, table4, table5, table6, |
|
49 |
table7, table8, table9, table10, table11, table12, table13, |
|
50 |
table14, table15, table16, table17, table18, table19, table20, |
|
51 |
table21, table22, table23, table24, table25, table26, table27, |
|
52 |
table28, table29, table30; |
|
53 |
||
54 |
use test; |
|
55 |
drop database mysqltest; |
|
56 |
||
57 |
# test drop/create database and FLUSH TABLES WITH READ LOCK |
|
58 |
flush tables with read lock; |
|
59 |
--error 1209,1223
|
|
60 |
create database mysqltest; |
|
61 |
unlock tables; |
|
62 |
create database mysqltest; |
|
63 |
show databases; |
|
64 |
flush tables with read lock; |
|
65 |
--error 1208,1223
|
|
66 |
drop database mysqltest; |
|
67 |
unlock tables; |
|
68 |
drop database mysqltest; |
|
69 |
show databases; |
|
70 |
--error 1008
|
|
71 |
drop database mysqltest; |
|
72 |
||
73 |
# test create table and FLUSH TABLES WITH READ LOCK |
|
74 |
drop table t1; |
|
75 |
flush tables with read lock; |
|
76 |
--error 1223
|
|
77 |
create table t1(n int); |
|
78 |
unlock tables; |
|
79 |
create table t1(n int); |
|
80 |
show tables; |
|
81 |
drop table t1; |
|
82 |
||
83 |
# End of 4.1 tests |
|
84 |
||
85 |
||
86 |
#
|
|
87 |
# Test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes |
|
88 |
# server to crash". Crash (caused by failed assertion in 5.0 or by null |
|
89 |
# pointer dereference in 5.1) happened when one ran SHOW OPEN TABLES |
|
90 |
# while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE |
|
91 |
# or any other command that takes name-lock) in other connection. |
|
92 |
#
|
|
93 |
# Also includes test for similar bug#12212 "Crash that happens during |
|
94 |
# removing of database name from cache" reappeared in 5.1 as bug#19403 |
|
95 |
# In its case crash happened when one concurrently executed DROP DATABASE |
|
96 |
# and one of name-locking command. |
|
97 |
#
|
|
98 |
--disable_warnings
|
|
99 |
drop database if exists mysqltest; |
|
100 |
drop table if exists t1; |
|
101 |
--enable_warnings
|
|
102 |
create table t1 (i int); |
|
103 |
lock tables t1 read; |
|
104 |
create database mysqltest; |
|
105 |
connect (addconroot1, localhost, root,,); |
|
106 |
--send drop table t1
|
|
107 |
connect (addconroot2, localhost, root,,); |
|
108 |
# Server should not crash in any of the following statements |
|
109 |
--disable_result_log
|
|
110 |
show open tables; |
|
111 |
--enable_result_log
|
|
112 |
--send drop database mysqltest
|
|
113 |
connection default; |
|
114 |
select 1; |
|
115 |
unlock tables; |
|
116 |
connection addconroot1; |
|
117 |
--reap
|
|
118 |
connection addconroot2; |
|
119 |
--reap
|
|
120 |
disconnect addconroot1; |
|
121 |
disconnect addconroot2; |
|
122 |
connection default; |
|
123 |
||
124 |
#
|
|
125 |
# Bug#25858 Some DROP TABLE under LOCK TABLES can cause deadlocks |
|
126 |
#
|
|
127 |
||
128 |
--disable_warnings
|
|
129 |
drop table if exists t1,t2; |
|
130 |
--enable_warnings
|
|
131 |
create table t1 (a int); |
|
132 |
create table t2 (a int); |
|
133 |
lock table t1 read; |
|
134 |
--error ER_TABLE_NOT_LOCKED
|
|
135 |
drop table t2; |
|
136 |
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
|
|
137 |
drop table t1; |
|
138 |
unlock tables; |
|
139 |
drop table t1,t2; |
|
140 |
connect (addconroot, localhost, root,,); |
|
141 |
connection default; |
|
142 |
create table t1 (i int); |
|
143 |
create table t2 (i int); |
|
144 |
lock tables t1 read; |
|
145 |
connection addconroot; |
|
146 |
lock tables t2 read; |
|
147 |
--error ER_TABLE_NOT_LOCKED
|
|
148 |
drop table t1; |
|
149 |
connection default; |
|
150 |
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
|
|
151 |
drop table t1,t2; |
|
152 |
disconnect addconroot; |
|
153 |
connection default; |
|
154 |
unlock tables; |
|
155 |
drop table t1,t2; |
|
156 |
||
157 |
--echo End of 5.0 tests
|
|
158 |
||
159 |
#
|
|
160 |
# Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file |
|
161 |
#
|
|
162 |
create database mysql_test; |
|
163 |
create table mysql_test.t1(f1 int); |
|
164 |
create table mysql_test.`#sql-347f_7` (f1 int); |
|
165 |
create table mysql_test.`#sql-347f_8` (f1 int); |
|
166 |
drop table mysql_test.`#sql-347f_8`; |
|
167 |
copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm; |
|
168 |
drop database mysql_test; |
|
169 |
||
170 |
#
|
|
171 |
# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks |
|
172 |
#
|
|
173 |
create database mysqltestbug26703; |
|
174 |
use mysqltestbug26703; |
|
175 |
create table `#mysql50#abc``def` ( id int ); |
|
176 |
--error ER_WRONG_TABLE_NAME
|
|
177 |
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); |
|
178 |
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); |
|
179 |
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); |
|
180 |
--error ER_WRONG_TABLE_NAME
|
|
181 |
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); |
|
182 |
use test; |
|
183 |
drop database mysqltestbug26703; |
|
184 |
||
185 |
###########################################################################
|
|
186 |
||
187 |
--echo
|
|
188 |
--echo End of 5.1 tests
|