diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 5d985d053fc..f90f3b07d70 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1259,6 +1259,10 @@ INSERT INTO t1 SELECT a + 8, b FROM t1; ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (64)); ALTER TABLE t1 DROP PARTITION p1; DROP TABLE t1; +create table t (s1 int) engine=myisam partition by key (s1); +create trigger t_ad after delete on t for each row insert into t values (old.s1); +insert into t values (1); +drop table t; USE mysql; SET GLOBAL general_log = 0; ALTER TABLE general_log ENGINE = MyISAM; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 42db23dadef..f391237a4db 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1480,6 +1480,15 @@ ALTER TABLE t1 DROP PARTITION p1; DROP TABLE t1; +# +# Bug #30484: Partitions: crash with self-referencing trigger +# + +create table t (s1 int) engine=myisam partition by key (s1); +create trigger t_ad after delete on t for each row insert into t values (old.s1); +insert into t values (1); +drop table t; + # # Bug #27816: Log tables ran with partitions crashes the server when logging # is enabled. diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 1ea3bb34514..6c1c89c4a04 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4546,6 +4546,8 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info, 4) Parameters only used by temporary tables for query processing 5) Parameters only used by MyISAM internally 6) Parameters not used at all + 7) Parameters only used by federated tables for query processing + 8) Parameters only used by NDB The partition handler need to handle category 1), 2) and 3). @@ -4812,6 +4814,15 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info, HA_EXTRA_INSERT_WITH_UPDATE: Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY. + + 8) Parameters only used by NDB + ------------------------------ + HA_EXTRA_DELETE_CANNOT_BATCH: + HA_EXTRA_UPDATE_CANNOT_BATCH: + Inform handler that delete_row()/update_row() cannot batch deletes/updates + and should perform them immediately. This may be needed when table has + AFTER DELETE/UPDATE triggers which access to subject table. + These flags are reset by the handler::extra(HA_EXTRA_RESET) call. */ int ha_partition::extra(enum ha_extra_function operation) @@ -4896,6 +4907,13 @@ int ha_partition::extra(enum ha_extra_function operation) /* Category 7), used by federated handlers */ case HA_EXTRA_INSERT_WITH_UPDATE: DBUG_RETURN(loop_extra(operation)); + /* Category 8) Parameters only used by NDB */ + case HA_EXTRA_DELETE_CANNOT_BATCH: + case HA_EXTRA_UPDATE_CANNOT_BATCH: + { + /* Currently only NDB use the *_CANNOT_BATCH */ + break; + } default: { /* Temporary crash to discover what is wrong */