From 94ad392fd86b53f798c7de9489afe901e1f3a9b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Oct 2013 13:45:49 +0300 Subject: MDEV-5143: update of a joined table with a nested subquery with a syntax error crashes mysqld with signal 11 Added check of SELECT_LEX::handle_derived() result. --- mysql-test/t/derived.test | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index b0db0e8100a..2a5ba77f38e 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -350,6 +350,40 @@ drop procedure p; drop temporary table t1; + +--echo # +--echo # MDEV-5143: update of a joined table with a nested subquery with +--echo # a syntax error crashes mysqld with signal 11 +--echo # + +create table t1 (id int(11) not null auto_increment, val varchar(100) null,primary key (id)); +create table t2 (id int(11) not null auto_increment, val varchar(100) null,primary key (id)); + +insert into t1 (val) values('a'); +insert into t2 (val) values('1'); + +--error ER_BAD_FIELD_ERROR +update + ( + select + val + from + ( + select + v.val + from + t2 wrong_table_alias + ) t4 + ) t3 + inner join t1 on + t1.id=t3.val +set + t1.val=t3.val +; + +drop table t1, t2; + + --echo # End of 5.3 tests set optimizer_switch=@save_derived_optimizer_switch; -- cgit v1.2.1