summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-12-03 15:46:49 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-12-04 07:10:41 +0300
commit477629d2cd3176850ef65eacad16f44bbc20fa2b (patch)
treef7a02501f7d0961733d3325c6205a84ddb4c031b /sql/sql_derived.cc
parentcef2b34f25b45198868be0c06e00a74a1c1ad062 (diff)
downloadmariadb-git-477629d2cd3176850ef65eacad16f44bbc20fa2b.tar.gz
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.
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 652353fb722..1f465a100c9 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -707,8 +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->prepare(derived, derived->derived_result, 0)))
+ if ((res= first_select->vers_setup_conds(thd,
+ derived->merge_underlying_list)))
goto exit;
+ 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;
}