Commit 670c9a3a authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge remote-tracking branch 'origin/bb-10.3-release' into 10.3

parents 81bf7d33 f6d8640d
......@@ -299,5 +299,13 @@ create or replace table t1 (id int, k int, primary key (id)) engine=innodb with
insert into t1 values (1,1),(2,2);
create or replace view v1 as select * from t1;
update v1 set id= 2 where k = 0;
create or replace table t1 (a int) with system versioning;
create or replace view v1 as select * from t1;
create or replace procedure sp() update v1 set xx = 1;
call sp;
ERROR 42S22: Unknown column 'xx' in 'field list'
call sp;
ERROR 42S22: Unknown column 'xx' in 'field list'
drop procedure sp;
drop view v1;
drop table t1;
......@@ -219,7 +219,16 @@ insert into t1 values (1,1),(2,2);
create or replace view v1 as select * from t1;
update v1 set id= 2 where k = 0;
create or replace table t1 (a int) with system versioning;
create or replace view v1 as select * from t1;
create or replace procedure sp() update v1 set xx = 1;
--error ER_BAD_FIELD_ERROR
call sp;
--error ER_BAD_FIELD_ERROR
call sp;
# cleanup
drop procedure sp;
drop view v1;
drop table t1;
......
......@@ -3379,11 +3379,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
Update the state of the active arena if no errors on
open_tables stage.
*/
if (likely(!res) || likely(!thd->is_error()) ||
(thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE_IN_ENGINE &&
thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
if (likely(!res) || likely(!thd->is_error()))
thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
/*
......
......@@ -707,9 +707,15 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
case SQLCOM_DELETE_MULTI:
case SQLCOM_UPDATE:
case SQLCOM_UPDATE_MULTI:
if ((res= unit->first_select()->vers_setup_conds(thd, derived->merge_underlying_list)))
if ((res= first_select->vers_setup_conds(thd,
derived->merge_underlying_list)))
goto exit;
derived->where= and_items(thd, derived->where, derived->merge_underlying_list->where);
if (derived->merge_underlying_list->where)
{
Query_arena_stmt on_stmt_arena(thd);
derived->where= and_items(thd, derived->where,
derived->merge_underlying_list->where);
}
default:
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment