Skip to content

Commit

Permalink
SQL: disable truncate history on partitioned [fixes #399]
Browse files Browse the repository at this point in the history
  • Loading branch information
midenok committed Dec 14, 2017
1 parent f96815f commit ab5ec0f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mysql-test/suite/versioning/r/truncate.result
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@ select * from t for system_time all;
a
11
22
### Issue #399, truncate partitioned table is now unimplemented
create or replace table t (a int)
with system versioning
engine myisam
partition by system_time (
partition p0 versioning,
partition pn as of current_timestamp);
truncate table t to system_time current_timestamp;
ERROR 42000: The used command is not allowed with this MariaDB version
drop table t;
1 change: 1 addition & 0 deletions mysql-test/suite/versioning/t/truncate.opt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--versioning-hide=implicit
--partition
12 changes: 12 additions & 0 deletions mysql-test/suite/versioning/t/truncate.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ select * from t for system_time all;
truncate table t to system_time timestamp now(6);
select * from t for system_time all;

--echo ### Issue #399, truncate partitioned table is now unimplemented

create or replace table t (a int)
with system versioning
engine myisam
partition by system_time (
partition p0 versioning,
partition pn as of current_timestamp);

--error ER_NOT_ALLOWED_COMMAND
truncate table t to system_time current_timestamp;

drop table t;
8 changes: 8 additions & 0 deletions sql/sql_delete.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
TABLE *table= table_list->table;
DBUG_ASSERT(table);

#ifdef WITH_PARTITION_STORAGE_ENGINE
if (table->part_info)
{
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0));
DBUG_RETURN(true);
}
#endif

DBUG_ASSERT(!conds);
if (select_lex->vers_setup_conds(thd, table_list, &conds))
DBUG_RETURN(TRUE);
Expand Down

0 comments on commit ab5ec0f

Please sign in to comment.