summaryrefslogtreecommitdiff
path: root/mysql-test/t/temp_table.test
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-08-29 16:59:20 +0400
committerunknown <kroki/tomash@moonlight.intranet>2006-08-29 16:59:20 +0400
commit4ed1ce6f583751c56c699017e58717e2bf23f53d (patch)
treeba2546344a0ab304d95d3eb0a1fef67fe9b33495 /mysql-test/t/temp_table.test
parent04d60b389701329d934ed2f7690cc2fd686b9f4a (diff)
downloadmariadb-git-4ed1ce6f583751c56c699017e58717e2bf23f53d.tar.gz
BUG#21096: locking issue ; temporary table conflicts.
The problem was that during DROP TEMPORARY TABLE we tried to acquire the name lock, though temporary tables belongs to one connection, and no race is possible. The solution is to not use table name locking while executing DROP TEMPORARY TABLE. mysql-test/r/temp_table.result: Add result for bug#21096: locking issue ; temporary table conflicts. mysql-test/t/temp_table.test: Add test case for bug#21096: locking issue ; temporary table conflicts. sql/sql_table.cc: Do not use table name locking while executing DROP TEMPORARY TABLE.
Diffstat (limited to 'mysql-test/t/temp_table.test')
-rw-r--r--mysql-test/t/temp_table.test48
1 files changed, 47 insertions, 1 deletions
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 309855d0b2d..69082840988 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -99,4 +99,50 @@ insert into t2 values (NULL, 'foo'), (NULL, 'bar');
select d, c from t1 left join t2 on b = c where a = 3 order by d;
drop table t1, t2;
-# End of 4.1 tests
+
+#
+# BUG#21096: locking issue ; temporary table conflicts.
+#
+# The problem was that on DROP TEMPORARY table name lock was acquired,
+# which should not be done.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+
+LOCK TABLE t1 WRITE;
+
+connect (conn1, localhost, root,,);
+
+CREATE TEMPORARY TABLE t1 (i INT);
+
+--echo The following command should not block
+DROP TEMPORARY TABLE t1;
+
+disconnect conn1;
+connection default;
+
+DROP TABLE t1;
+
+#
+# Check that it's not possible to drop a base table with
+# DROP TEMPORARY statement.
+#
+CREATE TABLE t1 (i INT);
+CREATE TEMPORARY TABLE t2 (i INT);
+
+--error 1051
+DROP TEMPORARY TABLE t2, t1;
+
+# Table t2 should have been dropped.
+--error 1146
+SELECT * FROM t2;
+# But table t1 should still be there.
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+
+--echo End of 4.1 tests.