summaryrefslogtreecommitdiff
path: root/sql/sql_truncate.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2017-08-08 17:12:16 +0300
committerGitHub <noreply@github.com>2017-08-08 17:12:16 +0300
commitd3d2ea9fd59a836dd0b0577658c5961712a5ed9d (patch)
tree2c146dff86192cd7073380c2b6632ea7ac8ed2f2 /sql/sql_truncate.cc
parent53370de103a58bff2d6c566f411e58d70bd5d446 (diff)
downloadmariadb-git-d3d2ea9fd59a836dd0b0577658c5961712a5ed9d.tar.gz
SQL, Parser: system_time logic and syntax fixes [closes #237]
Diffstat (limited to 'sql/sql_truncate.cc')
-rw-r--r--sql/sql_truncate.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 4faad5b4711..b65818a2716 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -492,18 +492,17 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
bool Sql_cmd_truncate_table::execute(THD *thd)
{
bool res= TRUE;
- TABLE_LIST *first_table= thd->lex->select_lex.table_list.first;
+ TABLE_LIST *table= thd->lex->select_lex.table_list.first;
DBUG_ENTER("Sql_cmd_truncate_table::execute");
- bool truncate_history= thd->lex->current_select->vers_conditions.type !=
- FOR_SYSTEM_TIME_UNSPECIFIED;
- if (truncate_history)
- DBUG_RETURN(mysql_delete(thd, first_table, NULL, NULL, -1, 0, NULL));
+ DBUG_ASSERT(table);
+ if (table->vers_conditions)
+ DBUG_RETURN(mysql_delete(thd, table, NULL, NULL, -1, 0, NULL));
- if (check_one_table_access(thd, DROP_ACL, first_table))
+ if (check_one_table_access(thd, DROP_ACL, table))
DBUG_RETURN(res);
- if (! (res= truncate_table(thd, first_table)))
+ if (! (res= truncate_table(thd, table)))
my_ok(thd);
DBUG_RETURN(res);