Bug #14351 Partitions: triggers aren't activated by effective deletion
Submitted: 26 Oct 2005 20:09 Modified: 18 Apr 2006 17:23
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1.2-alpha-debug OS:Linux (SUSE 10.0)
Assigned to: Documentation Team CPU Architecture:Any

[26 Oct 2005 20:09] Peter Gulutzan
Description:
When I drop a partition, I am in effect deleting all the rows
of the partition. The manual acknowledges that, it suggests
using ALTER ... DROP PARTITION to "delete ... records". But
I have an AFTER DELETE trigger, and it isn't activated when
I drop the partition.

How to repeat:
mysql> create table t4 (s1 int) partition by list (s1) (partition p1 values in (1), partition p2 values in (2));
Query OK, 0 rows affected (0.00 sec)

mysql> create trigger t4_ad after delete on t4 for each row set @a = 55;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t4 values (1);
Query OK, 1 row affected (0.00 sec)

mysql> alter table t4 drop partition p1;
Query OK, 0 rows affected (0.01 sec)

mysql> select @a;
+------+
| @a   |
+------+
| NULL |
+------+
1 row in set (0.01 sec)
[26 Oct 2005 21:18] Jorge del Conde
I was able to reproduce this bug using a recent 5.1 clone
[18 Apr 2006 16:03] Reggie Burnett
Please document that just like truncate table or drop table, dropping a partition does not use delete and therefore will not activate any delete triggers.
[18 Apr 2006 17:23] Paul DuBois
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).