Skip to content

Commit ab5ec0f

Browse files
committed
SQL: disable truncate history on partitioned [fixes #399]
1 parent f96815f commit ab5ec0f

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

mysql-test/suite/versioning/r/truncate.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,13 @@ select * from t for system_time all;
3434
a
3535
11
3636
22
37+
### Issue #399, truncate partitioned table is now unimplemented
38+
create or replace table t (a int)
39+
with system versioning
40+
engine myisam
41+
partition by system_time (
42+
partition p0 versioning,
43+
partition pn as of current_timestamp);
44+
truncate table t to system_time current_timestamp;
45+
ERROR 42000: The used command is not allowed with this MariaDB version
3746
drop table t;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--versioning-hide=implicit
2+
--partition

mysql-test/suite/versioning/t/truncate.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,16 @@ select * from t for system_time all;
2828
truncate table t to system_time timestamp now(6);
2929
select * from t for system_time all;
3030

31+
--echo ### Issue #399, truncate partitioned table is now unimplemented
32+
33+
create or replace table t (a int)
34+
with system versioning
35+
engine myisam
36+
partition by system_time (
37+
partition p0 versioning,
38+
partition pn as of current_timestamp);
39+
40+
--error ER_NOT_ALLOWED_COMMAND
41+
truncate table t to system_time current_timestamp;
42+
3143
drop table t;

sql/sql_delete.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
315315
TABLE *table= table_list->table;
316316
DBUG_ASSERT(table);
317317

318+
#ifdef WITH_PARTITION_STORAGE_ENGINE
319+
if (table->part_info)
320+
{
321+
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0));
322+
DBUG_RETURN(true);
323+
}
324+
#endif
325+
318326
DBUG_ASSERT(!conds);
319327
if (select_lex->vers_setup_conds(thd, table_list, &conds))
320328
DBUG_RETURN(TRUE);

0 commit comments

Comments
 (0)