summaryrefslogtreecommitdiff
path: root/mysql-test/t/create.test
diff options
context:
space:
mode:
authordavi@moksha.local <>2007-09-28 18:25:47 -0300
committerdavi@moksha.local <>2007-09-28 18:25:47 -0300
commitae079ec427c2a5d50940b7c20f45e0c92f01e450 (patch)
treeaf230e13a7ed9751a3504b3e824f902b122d6f24 /mysql-test/t/create.test
parent2a70d6fa97d40c708b033c8eaee57f1f3ac5ad0d (diff)
downloadmariadb-git-ae079ec427c2a5d50940b7c20f45e0c92f01e450.tar.gz
Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crash
When CREATE TEMPORARY TABLE .. SELECT is invoked from a stored function which in turn is called from CREATE TABLE SELECT causes a memory leak because the inner create temporary table overrides the outter extra_lock reference when locking the table. The solution is to simply not overrride the extra_lock by only using the extra_lock for a non-temporary table lock.
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r--mysql-test/t/create.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index d4feeebe4b1..023e55ea418 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1303,4 +1303,29 @@ return 0;
drop view имя_вью_кодировке_утф8_длиной_больше_чем_42;
drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
set names default;
+
+#
+# Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crash
+#
+
+--disable_warnings
+drop table if exists t1,t2,t3;
+drop function if exists f1;
+--enable_warnings
+
+--delimiter |
+create function f1() returns int
+begin
+ declare res int;
+ create temporary table t3 select 1 i;
+ set res:= (select count(*) from t1);
+ drop temporary table t3;
+ return res;
+end|
+--delimiter ;
+create table t1 as select 1;
+create table t2 as select f1() from t1;
+drop table t1,t2;
+drop function f1;
+
--echo End of 5.1 tests