1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view

Unit prepare prematurely fixed field which must be fixed via
setup_conds() to correctly update table->covering_keys.

Call vers_setup_conds() directly instead, because actually everything
else is not needed.
This commit is contained in:
Aleksey Midenkov
2019-12-03 15:46:49 +03:00
parent cef2b34f25
commit bf2f391664
3 changed files with 11 additions and 1 deletions

View File

@ -295,5 +295,9 @@ primary key (pk)
create or replace view v1 as select * from t1; create or replace view v1 as select * from t1;
insert into t1 values (1, null, 'd') , (2, null, 'i') ; insert into t1 values (1, null, 'd') , (2, null, 'i') ;
update v1 set a= null where b = ''; update v1 set a= null where b = '';
create or replace table t1 (id int, k int, primary key (id)) engine=innodb with system versioning;
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;
drop view v1; drop view v1;
drop table t1; drop table t1;

View File

@ -214,6 +214,11 @@ create or replace view v1 as select * from t1;
insert into t1 values (1, null, 'd') , (2, null, 'i') ; insert into t1 values (1, null, 'd') , (2, null, 'i') ;
update v1 set a= null where b = ''; update v1 set a= null where b = '';
create or replace table t1 (id int, k int, primary key (id)) engine=innodb with system versioning;
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;
# cleanup # cleanup
drop view v1; drop view v1;
drop table t1; drop table t1;

View File

@ -707,8 +707,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
case SQLCOM_DELETE_MULTI: case SQLCOM_DELETE_MULTI:
case SQLCOM_UPDATE: case SQLCOM_UPDATE:
case SQLCOM_UPDATE_MULTI: case SQLCOM_UPDATE_MULTI:
if ((res= unit->prepare(derived, derived->derived_result, 0))) if ((res= unit->first_select()->vers_setup_conds(thd, derived->merge_underlying_list)))
goto exit; goto exit;
derived->where= and_items(thd, derived->where, derived->merge_underlying_list->where);
default: default:
break; break;
} }