summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@rakia.gmz>2007-02-01 11:07:17 +0200
committerunknown <gkodinov/kgeorge@rakia.gmz>2007-02-01 11:07:17 +0200
commit020e82c6505ff22415145fb86c70a2fae9a5d2a4 (patch)
treeb2ddab9d0574cc747dd55917cdef2cb989b43fd0 /sql/sql_delete.cc
parentc15b2e4152854f48ba3f43ace52103010bca603d (diff)
parent1a0e1f1328c933d63e0bb0d99b9011058abd82cd (diff)
downloadmariadb-git-020e82c6505ff22415145fb86c70a2fae9a5d2a4.tar.gz
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rakia.gmz:/home/kgeorge/mysql/autopush/B23556-5.0-opt mysql-test/t/trigger.test: Auto merged sql/sql_delete.cc: Auto merged
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index e8291edda5d..94d753eb703 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -75,10 +75,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
Test if the user wants to delete all rows and deletion doesn't have
any side-effects (because of triggers), so we can use optimized
handler::delete_all_rows() method.
+ We implement fast TRUNCATE for InnoDB even if triggers are present.
+ TRUNCATE ignores triggers.
*/
if (!using_limit && const_cond && (!conds || conds->val_int()) &&
!(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) &&
- !(table->triggers && table->triggers->has_delete_triggers()))
+ (thd->lex->sql_command == SQLCOM_TRUNCATE ||
+ !(table->triggers && table->triggers->has_delete_triggers()))
+ )
{
deleted= table->file->records;
if (!(error=table->file->delete_all_rows()))