summaryrefslogtreecommitdiff
path: root/mysql-test/t/drop.test
blob: 88c47803f48f6622c9678638e5476fc6e9ba4b3c (plain)
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
# Initialise
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings

--error 1051;
drop table t1;
create table t1(n int);
insert into t1 values(1);
create temporary table t1( n int);
insert into t1 values(2);
--error 1050;
create table t1(n int);
drop table t1;
select * from t1;

# now test for a bug in drop database - it is important that the name
# of the table is the same as the name of the database - in the original
# code this triggered a bug
create database mysqltest;
drop database if exists mysqltest;
create database mysqltest;
create table mysqltest.mysqltest (n int);
insert into mysqltest.mysqltest values (4);
select * from mysqltest.mysqltest;
--enable_info
drop database if exists mysqltest;
--disable_info
create database mysqltest;
drop database mysqltest;

# test drop/create database and FLUSH TABLES WITH READ LOCK
flush tables with read lock;
--error 1209,1223;
create database mysqltest;
unlock tables;
create database mysqltest;
show databases;
flush tables with read lock;
--error 1208,1223;
drop database mysqltest;
unlock tables;
drop database mysqltest;
show databases;
--error 1008
drop database mysqltest;

# test create table and FLUSH TABLES WITH READ LOCK
drop table t1;
flush tables with read lock;
--error 1223;
create table t1(n int);
unlock tables;
create table t1(n int);
show tables;
drop table t1;