summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2017-12-19 15:12:11 +0300
committerGitHub <noreply@github.com>2017-12-19 15:12:11 +0300
commit8ba06032aea45c9a7d587b60d3a783f265726bd7 (patch)
tree1a6f9eb47c3a21a8c30a6db27286265b88b9ba56 /sql/sql_delete.cc
parent04bed58acf4a4b66e66eff1afb6086ea6093b0f0 (diff)
downloadmariadb-git-8ba06032aea45c9a7d587b60d3a783f265726bd7.tar.gz
MDEV-14684 Assertion `table' failed in mysql_delete
SQL: disable TRUNCATE table_name TO statement for VIEWs
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 9c535e2124a..fcd5708863a 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -312,6 +312,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
bool truncate_history= table_list->vers_conditions;
if (truncate_history)
{
+ if (table_list->is_view_or_derived())
+ {
+ my_error(ER_VERS_TRUNCATE_TO_VIEW, MYF(0));
+ DBUG_RETURN(true);
+ }
+
TABLE *table= table_list->table;
DBUG_ASSERT(table);
@@ -328,7 +334,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(TRUE);
// trx_sees() in InnoDB reads sys_trx_start
- if (!table->versioned(VERS_TIMESTAMP)) {
+ if (!table->versioned(VERS_TIMESTAMP))
+ {
DBUG_ASSERT(table_list->vers_conditions.type == SYSTEM_TIME_BEFORE);
bitmap_set_bit(table->read_set, table->vers_end_field()->field_index);
}