1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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.
This commit is contained in:
Davi Arnaut
2009-01-07 10:11:37 -02:00
parent 645b4862c9
commit dc5a0f4481
5 changed files with 131 additions and 1 deletions

View File

@@ -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