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.
This commit is contained in:
parent
046fe91161
commit
94ad392fd8
@ -438,5 +438,32 @@ CALL p();
|
|||||||
id
|
id
|
||||||
drop procedure p;
|
drop procedure p;
|
||||||
drop temporary table t1;
|
drop temporary table t1;
|
||||||
|
#
|
||||||
|
# MDEV-5143: update of a joined table with a nested subquery with
|
||||||
|
# a syntax error crashes mysqld with signal 11
|
||||||
|
#
|
||||||
|
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');
|
||||||
|
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
|
||||||
|
;
|
||||||
|
ERROR 42S22: Unknown column 'v.val' in 'field list'
|
||||||
|
drop table t1, t2;
|
||||||
# End of 5.3 tests
|
# End of 5.3 tests
|
||||||
set optimizer_switch=@save_derived_optimizer_switch;
|
set optimizer_switch=@save_derived_optimizer_switch;
|
||||||
|
@ -350,6 +350,40 @@ drop procedure p;
|
|||||||
|
|
||||||
drop temporary table t1;
|
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
|
--echo # End of 5.3 tests
|
||||||
|
|
||||||
set optimizer_switch=@save_derived_optimizer_switch;
|
set optimizer_switch=@save_derived_optimizer_switch;
|
||||||
|
@ -619,7 +619,8 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
|
|||||||
{
|
{
|
||||||
sl->context.outer_context= 0;
|
sl->context.outer_context= 0;
|
||||||
// Prepare underlying views/DT first.
|
// Prepare underlying views/DT first.
|
||||||
sl->handle_derived(lex, DT_PREPARE);
|
if ((res= sl->handle_derived(lex, DT_PREPARE)))
|
||||||
|
goto exit;
|
||||||
|
|
||||||
if (derived->outer_join)
|
if (derived->outer_join)
|
||||||
{
|
{
|
||||||
|
@ -2485,7 +2485,13 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
|
|||||||
/* Fix ORDER list */
|
/* Fix ORDER list */
|
||||||
for (order= sl->order_list.first; order; order= order->next)
|
for (order= sl->order_list.first; order; order= order->next)
|
||||||
order->item= &order->item_ptr;
|
order->item= &order->item_ptr;
|
||||||
sl->handle_derived(lex, DT_REINIT);
|
{
|
||||||
|
#ifndef DBUG_OFF
|
||||||
|
bool res=
|
||||||
|
#endif
|
||||||
|
sl->handle_derived(lex, DT_REINIT);
|
||||||
|
DBUG_ASSERT(res == 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SELECT_LEX_UNIT *unit= sl->master_unit();
|
SELECT_LEX_UNIT *unit= sl->master_unit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user