summaryrefslogtreecommitdiff
path: root/mysql-test/r/temp_table.result
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-01-07 10:11:37 -0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-01-07 10:11:37 -0200
commit7ba37134d247f6057302f6af9893df603d14afae (patch)
tree16f893cdfcf2c58dcdd814d7fa23d376fb02335c /mysql-test/r/temp_table.result
parent6ff7a3264f83b7f39888bd3e1f08e2862828c28e (diff)
downloadmariadb-git-7ba37134d247f6057302f6af9893df603d14afae.tar.gz
Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites
locking type of temp table The problem is that INSERT INTO .. SELECT FROM .. and CREATE TABLE .. SELECT FROM a temporary table could inadvertently overwrite the locking type of the temporary table. The lock type of temporary tables should be a write lock by default. The solution is to reset the lock type of temporary tables back to its default value after they are used in a statement. mysql-test/r/innodb_mysql.result: Add test case result for Bug#41348 mysql-test/r/temp_table.result: Add test case result for Bug#41348 mysql-test/t/innodb_mysql.test: Add test case for Bug#41348 mysql-test/t/temp_table.test: Add test case for Bug#41348 sql/sql_base.cc: Allow the lock type of temp tables to be overwritten now that the the value is being restored once the table is marked as free for re-use. This makes the behavior consistent with that of non-temporary tables and avoids confusion.
Diffstat (limited to 'mysql-test/r/temp_table.result')
-rw-r--r--mysql-test/r/temp_table.result16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 6df09463d02..ba6b9f81a2d 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -194,4 +194,20 @@ DELETE FROM t1;
SELECT * FROM t1;
a b
DROP TABLE t1;
+DROP TABLE IF EXISTS t1,t2;
+DROP FUNCTION IF EXISTS f1;
+CREATE TEMPORARY TABLE t1 (a INT);
+CREATE TEMPORARY TABLE t2 LIKE t1;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+return 1;
+END|
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t1 SELECT f1();
+CREATE TABLE t3 SELECT * FROM t1;
+INSERT INTO t1 SELECT f1();
+UPDATE t1,t2 SET t1.a = t2.a;
+INSERT INTO t2 SELECT f1();
+DROP TABLE t1,t2,t3;
+DROP FUNCTION f1;
End of 5.1 tests