~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to mysql-test/t/drop.test

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
create database mysqltest;
 
104
lock tables t1 read;
 
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 addconroot2;
 
121
--source include/wait_until_disconnected.inc
 
122
connection addconroot1;
 
123
disconnect addconroot1;
 
124
--source include/wait_until_disconnected.inc
 
125
connection default;
 
126
 
 
127
#
 
128
# Bug#25858 Some DROP TABLE under LOCK TABLES can cause deadlocks
 
129
#
 
130
 
 
131
--disable_warnings
 
132
drop table if exists t1,t2;
 
133
--enable_warnings
 
134
create table t1 (a int);
 
135
create table t2 (a int);
 
136
lock table t1 read;
 
137
--error ER_TABLE_NOT_LOCKED
 
138
drop table t2;
 
139
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
 
140
drop table t1;
 
141
unlock tables;
 
142
drop table t1,t2;
 
143
connect (addconroot, localhost, root,,);
 
144
connection default;
 
145
create table t1 (i int);
 
146
create table t2 (i int);
 
147
lock tables t1 read;
 
148
connection addconroot;
 
149
lock tables t2 read;
 
150
--error ER_TABLE_NOT_LOCKED
 
151
drop table t1;
 
152
connection default;
 
153
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
 
154
drop table t1,t2;
 
155
disconnect addconroot;
 
156
connection default;
 
157
unlock tables;
 
158
drop table t1,t2;
 
159
 
 
160
--echo End of 5.0 tests
 
161
 
 
162
#
 
163
# Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
 
164
#
 
165
create database mysql_test;
 
166
create table mysql_test.t1(f1 int);
 
167
create table mysql_test.`#sql-347f_7` (f1 int);
 
168
create table mysql_test.`#sql-347f_8` (f1 int);
 
169
drop table mysql_test.`#sql-347f_8`;
 
170
let $MYSQLD_DATADIR= `select @@datadir`;
 
171
copy_file $MYSQLD_DATADIR/mysql_test/t1.frm $MYSQLD_DATADIR/mysql_test/#sql-347f_6.frm;
 
172
drop database mysql_test;
 
173
 
 
174
###########################################################################
 
175
 
 
176
--echo
 
177
--echo # --
 
178
--echo # -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not
 
179
--echo # -- exist.
 
180
--echo # --
 
181
 
 
182
--disable_warnings
 
183
DROP DATABASE IF EXISTS mysql_test;
 
184
--enable_warnings
 
185
 
 
186
CREATE DATABASE mysql_test;
 
187
 
 
188
let $MYSQLD_DATADIR= `select @@datadir`;
 
189
 
 
190
--let $proc_frm = $MYSQLD_DATADIR/mysql/proc.frm
 
191
--let $proc_MYD = $MYSQLD_DATADIR/mysql/proc.MYD
 
192
--let $proc_MYI = $MYSQLD_DATADIR/mysql/proc.MYI
 
193
 
 
194
--let $copy_of_proc_frm = $MYSQLTEST_VARDIR/tmp/bug29958.copy.frm
 
195
--let $copy_of_proc_MYD = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYD
 
196
--let $copy_of_proc_MYI = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYI
 
197
 
 
198
--copy_file $proc_frm $copy_of_proc_frm
 
199
--copy_file $proc_MYD $copy_of_proc_MYD
 
200
--copy_file $proc_MYI $copy_of_proc_MYI
 
201
 
 
202
DROP TABLE mysql.proc;
 
203
 
 
204
DROP DATABASE mysql_test;
 
205
 
 
206
--copy_file $copy_of_proc_frm $proc_frm
 
207
--copy_file $copy_of_proc_MYD $proc_MYD
 
208
--copy_file $copy_of_proc_MYI $proc_MYI
 
209
 
 
210
--remove_file $copy_of_proc_frm
 
211
--remove_file $copy_of_proc_MYD
 
212
--remove_file $copy_of_proc_MYI
 
213
 
 
214
--echo
 
215
--echo # --
 
216
--echo # -- End of Bug#29958.
 
217
--echo # --
 
218
 
 
219
###########################################################################
 
220
 
 
221
--echo
 
222
#
 
223
# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
 
224
#
 
225
create database mysqltestbug26703;
 
226
use mysqltestbug26703;
 
227
create table `#mysql50#abc``def` ( id int );
 
228
--error ER_TOO_LONG_IDENT
 
229
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
 
230
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
 
231
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
 
232
--error ER_TOO_LONG_IDENT
 
233
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
 
234
use test;
 
235
drop database mysqltestbug26703;
 
236
 
 
237
--echo End of 5.1 tests
 
238
 
 
239
###########################################################################
 
240
 
 
241
--echo
 
242
--echo # --
 
243
--echo # -- Bug#37431 (DROP TABLE does not report errors correctly).
 
244
--echo # --
 
245
 
 
246
--disable_warnings
 
247
DROP TABLE IF EXISTS t1;
 
248
--enable_warnings
 
249
 
 
250
--error ER_BAD_TABLE_ERROR
 
251
DROP TABLE t1;
 
252
 
 
253
SHOW WARNINGS;
 
254
 
 
255
--echo
 
256
--echo # --
 
257
--echo # -- End of Bug#37431.
 
258
--echo # --
 
259
 
 
260
 
 
261
--echo #
 
262
--echo # Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
 
263
--echo #
 
264
 
 
265
--disable_warnings
 
266
DROP TABLE IF EXISTS t1;
 
267
--enable_warnings
 
268
 
 
269
CREATE TABLE t1 (a INT);
 
270
LOCK TABLE t1 WRITE;
 
271
--error ER_NONUNIQ_TABLE
 
272
DROP TABLE t1, t1;
 
273
 
 
274
UNLOCK TABLES;
 
275
DROP TABLE t1;
 
276
 
 
277
--echo #
 
278
--echo # BUG#34750: Print database name in Unknown Table error message
 
279
--echo #
 
280
 
 
281
--echo 
 
282
--echo # Test error message when droping table/view
 
283
 
 
284
--error ER_BAD_TABLE_ERROR
 
285
DROP TABLE table1;
 
286
--error ER_BAD_TABLE_ERROR
 
287
DROP TABLE table1,table2;
 
288
--error ER_BAD_TABLE_ERROR
 
289
DROP VIEW view1,view2,view3,view4;
 
290
--echo
 
291
DROP TABLE IF EXISTS table1;
 
292
DROP TABLE IF EXISTS table1,table2;
 
293
DROP VIEW IF EXISTS view1,view2,view3,view4;
 
294
 
 
295
--echo
 
296
--echo # Test error message when trigger does not find table
 
297
 
 
298
CREATE TABLE table1(a int);
 
299
CREATE TABLE table2(b int);
 
300
 
 
301
# Database name is only available (for printing) if specified in 
 
302
# the trigger definition
 
303
CREATE TRIGGER trg1 AFTER INSERT ON table1
 
304
FOR EACH ROW
 
305
  INSERT INTO table2 SELECT t.notable.*;
 
306
 
 
307
--error ER_BAD_TABLE_ERROR
 
308
INSERT INTO table1 VALUES (1);
 
309
 
 
310
DROP TABLE table1,table2;
 
311
 
 
312
--echo # End BUG#34750