From 33f55789d354b0fccf5234027dc0bd66cbd0c539 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Mon, 25 Nov 2019 16:01:43 +0300 Subject: MDEV-18727 improve DML operation of System Versioning (10.4) UPDATE, DELETE: replace linear search of current/historical records with vers_setup_conds(). Additional DML cases in view.test --- sql/sql_derived.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql/sql_derived.cc') diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 06e82263524..06a3e8a108f 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -723,7 +723,17 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) !(derived->is_multitable() && (thd->lex->sql_command == SQLCOM_UPDATE_MULTI || thd->lex->sql_command == SQLCOM_DELETE_MULTI)))) + { + /* + System versioned tables may still require to get versioning conditions + (when updating view). See vers_setup_conds(). + */ + if (!unit->prepared && + derived->table->versioned() && + (res= unit->prepare(derived, derived->derived_result, 0))) + goto exit; DBUG_RETURN(FALSE); + } /* prevent name resolving out of derived table */ for (SELECT_LEX *sl= first_select; sl; sl= sl->next_select()) -- cgit v1.2.1