summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-11-22 14:29:03 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-11-22 14:29:03 +0300
commit0076dce2c89248b6c0252ec4385879194f9aadbf (patch)
tree1774fb25fcbe854aee956841ab28298029b548f6 /sql/sql_derived.cc
parenta14544260c33dcdb057d2f62c4aab33cb09ebcb1 (diff)
downloadmariadb-git-0076dce2c89248b6c0252ec4385879194f9aadbf.tar.gz
MDEV-18727 improve DML operation of System Versioning
MDEV-18957 UPDATE with LIMIT clause is wrong for versioned partitioned tables UPDATE, DELETE: replace linear search of current/historical records with vers_setup_conds(). Additional DML cases in view.test
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 44ea6a18663..44595746614 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -689,7 +689,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())