diff options
author | Alexander Nozdrin <alik@sun.com> | 2009-12-11 12:39:38 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2009-12-11 12:39:38 +0300 |
commit | 567671368723c704d60902b4d0ccff951b414552 (patch) | |
tree | 965519a5b0af3f33624c7e16fd61b58d15f42372 /sql/sql_delete.cc | |
parent | efee0608316e4cc034a3e62d05980eef8530843d (diff) | |
parent | ceefe7bb50b17b72e88851e3b98642e89a4cddae (diff) | |
download | mariadb-git-567671368723c704d60902b4d0ccff951b414552.tar.gz |
Manual merge from mysql-trunk.
Conflicts:
- client/mysqltest.cc
- mysql-test/collections/default.experimental
- mysql-test/suite/rpl/t/disabled.def
- sql/mysqld.cc
- sql/opt_range.cc
- sql/sp.cc
- sql/sql_acl.cc
- sql/sql_partition.cc
- sql/sql_table.cc
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 6b9a83e695b..6d7ece3912b 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1104,6 +1104,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) is_temporary_table= true; 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; @@ -1142,8 +1143,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)) |