mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-5535: Cannot reopen temporary table
Temporary table being created by outer statement should not be visible to inner statement. And if inner statement creates a table with same name. The whole statement should fail with ER_TABLE_EXISTS_ERROR. Implemented by temporarily de-linking the TABLE_SHARE being created by outer statement so that it remains hidden to the inner statement.
This commit is contained in:
@@ -24,6 +24,31 @@ DROP TABLE t1;
|
||||
--echo # CREATE & Stored routines
|
||||
--echo #
|
||||
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION f1() RETURNS INT
|
||||
BEGIN
|
||||
DROP TEMPORARY TABLE t1;
|
||||
RETURN 1;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
CREATE TEMPORARY TABLE t1 AS SELECT f1();
|
||||
DROP FUNCTION f1;
|
||||
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION f2() RETURNS INT
|
||||
BEGIN
|
||||
CREATE TEMPORARY TABLE t2(i INT);
|
||||
INSERT INTO t2 VALUES(1), (2);
|
||||
RETURN 1;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
CREATE TEMPORARY TABLE t2 AS SELECT f2();
|
||||
SELECT * FROM t2;
|
||||
DROP TABLE t2;
|
||||
DROP FUNCTION f2;
|
||||
|
||||
CREATE TEMPORARY TABLE t3 AS SELECT 1 AS a;
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE p1()
|
||||
|
||||
Reference in New Issue
Block a user