mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MDEV-11129 CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc() references t1
Fixed by extending unique_table() with a flag to not allow usage of the replaced table. I also cleaned up find_dup_table() to not use goto next. I also added more comments to the code in find_dup_table()
This commit is contained in:
@@ -398,3 +398,28 @@ CREATE OR REPLACE TABLE t1 AS SELECT f1();
|
||||
UNLOCK TABLES;
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11129
|
||||
--echo # CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc()
|
||||
--echo # references t1
|
||||
--echo #
|
||||
|
||||
CREATE OR REPLACE TABLE t1(a INT);
|
||||
DELIMITER $$;
|
||||
CREATE FUNCTION f1() RETURNS VARCHAR(16383)
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES(1);
|
||||
RETURN 'test';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
--error ER_UPDATE_TABLE_USED
|
||||
CREATE OR REPLACE TABLE t1 AS SELECT f1();
|
||||
LOCK TABLE t1 WRITE;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
CREATE OR REPLACE TABLE t1 AS SELECT f1();
|
||||
UNLOCK TABLES;
|
||||
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
|
||||
Reference in New Issue
Block a user