diff options
author | Mikael Ronstrom <mikael@mysql.com> | 2009-09-10 11:15:39 +0200 |
---|---|---|
committer | Mikael Ronstrom <mikael@mysql.com> | 2009-09-10 11:15:39 +0200 |
commit | d0d52e9f11ab7bad11d34d207139a26f26dd362c (patch) | |
tree | e4de6989be4d51f542339759b99eec9a100c3c33 /sql/sql_delete.cc | |
parent | 905d715f10e711860311e0a10488c6bb5e19ee49 (diff) | |
download | mariadb-git-d0d52e9f11ab7bad11d34d207139a26f26dd362c.tar.gz |
WL#4444 Added TRUNCATE partition support, fixes bug#19405 and bug #35111
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index d2f90fa9288..ee272dad341 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1075,6 +1075,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) { handlerton *table_type= table->s->db_type(); TABLE_SHARE *share= table->s; + /* Note that a temporary table cannot be partitioned */ if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)) goto trunc_by_del; @@ -1113,8 +1114,22 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) table_list->db, table_list->table_name); DBUG_RETURN(TRUE); } - if (!ha_check_storage_engine_flag(ha_resolve_by_legacy_type(thd, table_type), - HTON_CAN_RECREATE)) +#ifdef WITH_PARTITION_STORAGE_ENGINE + /* + TODO: Add support for TRUNCATE PARTITION for NDB and other engines + supporting native partitioning + */ + if (table_type != DB_TYPE_PARTITION_DB && + thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION) + { + my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0)); + DBUG_RETURN(TRUE); + } +#endif + if (!ha_check_storage_engine_flag(ha_resolve_by_legacy_type(thd, + table_type), + HTON_CAN_RECREATE) || + thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION) goto trunc_by_del; if (lock_and_wait_for_table_name(thd, table_list)) |