diff options
author | unknown <sanja@montyprogram.com> | 2014-01-23 12:05:10 +0200 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2014-01-23 12:05:10 +0200 |
commit | d9cb1352c8256d9c19a3d29af6fe3d705578a413 (patch) | |
tree | 1a48e97d1682ea753c59bccff73d4815e19d7351 /mysql-test | |
parent | bea9f82653dfafca0b2abc4357a5bb7f5cff826a (diff) | |
parent | 5f5f7befe37e942d4fff0771ac79d143ca4500c6 (diff) | |
download | mariadb-git-d9cb1352c8256d9c19a3d29af6fe3d705578a413.tar.gz |
merge of MDEV-5356 5.1->5.3 (with more fixes and test suite).
THD::thd->activate_stmt_arena_if_needed() should be used to temporary activating statement arena instead of direct usage of THD::set_n_backup_active_arena() because possible such scenario:
1) func1 saves current arena and activates copy1 of statement arena
2) func2 saves copy1 of statement arena setup by func1 and activates copy2
3) some changes made for copy 2
4) func2 stores changed copy2 back to statenet arena and activates copy1
5) func1 store unchanged copy1 back to statemnt arena (rewrite changed copy 2 so changes become lost) and activates arena which was before.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/derived.result | 22 | ||||
-rw-r--r-- | mysql-test/t/derived.test | 29 |
2 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 3ad9d99651a..dcf54d55886 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -479,5 +479,27 @@ SELECT * FROM WHERE tmp.a; a b 100 200 +# +# MDEV-5356: Server crashes in Item_equal::contains on 2nd +# execution of a PS +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,4); +CREATE TABLE t2 (c INT); +INSERT INTO t2 VALUES (5),(6); +CREATE TABLE t3 (d INT); +INSERT INTO t3 VALUES (7),(8); +CREATE PROCEDURE pr() +UPDATE t3, +(SELECT c FROM +(SELECT 1 FROM t1 WHERE a=72 AND NOT b) sq, +t2 +) sq2 +SET d=sq2.c; +CALL pr(); +CALL pr(); +CALL pr(); +drop procedure pr; +drop table t1,t2,t3; # End of 5.3 tests set optimizer_switch=@save_derived_optimizer_switch; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 4f6b8443055..c2921cd6b03 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -394,6 +394,35 @@ WHERE tmp.b; SELECT * FROM ( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp WHERE tmp.a; + +--echo # +--echo # MDEV-5356: Server crashes in Item_equal::contains on 2nd +--echo # execution of a PS +--echo # +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,4); + +CREATE TABLE t2 (c INT); +INSERT INTO t2 VALUES (5),(6); + +CREATE TABLE t3 (d INT); +INSERT INTO t3 VALUES (7),(8); + +CREATE PROCEDURE pr() + UPDATE t3, + (SELECT c FROM + (SELECT 1 FROM t1 WHERE a=72 AND NOT b) sq, + t2 + ) sq2 + SET d=sq2.c; + +CALL pr(); +CALL pr(); +CALL pr(); + +drop procedure pr; +drop table t1,t2,t3; + --echo # End of 5.3 tests set optimizer_switch=@save_derived_optimizer_switch; |