diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-04-16 23:05:22 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-04-16 23:05:22 +0300 |
commit | 7214d07baf67817974a87da9faa61eaa8e2bb4ae (patch) | |
tree | 081bc68bd4124f762ece04b1593b1b823e4c8ffd /innobase | |
parent | 31d0d6e5bddcc4394a2bfd0320d3f01203146530 (diff) | |
download | mariadb-git-7214d07baf67817974a87da9faa61eaa8e2bb4ae.tar.gz |
row0ins.c:
Better fix for the ON DELETE SET NULL problem
innobase/row/row0ins.c:
Better fix for the ON DELETE SET NULL problem
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/row/row0ins.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 611f5cd30d1..596273477aa 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -323,7 +323,7 @@ row_ins_clust_index_entry_by_modify( /************************************************************************* Returns TRUE if in a cascaded update/delete an ancestor node of node -updates table. */ +updates (not DELETE, but UPDATE) table. */ static ibool row_ins_cascade_ancestor_updates_table( @@ -341,7 +341,7 @@ row_ins_cascade_ancestor_updates_table( upd_node = parent; - if (upd_node->table == table) { + if (upd_node->table == table && upd_node->is_delete == FALSE) { return(TRUE); } @@ -678,17 +678,15 @@ row_ins_foreign_check_on_constraint( } } - /* We do not allow cyclic cascaded updating of the same table, except - in the case the update is the action of ON DELETE SET NULL, which - cannot lead to an infinite cycle. Check that we are not updating the - same table which is already being modified in this cascade chain. We - have to check this because the modification of the indexes of a - 'parent' table may still be incomplete, and we must avoid seeing the - indexes of the parent table in an inconsistent state! In this way we - also prevent possible infinite update loops caused by cyclic cascaded - updates. */ + /* We do not allow cyclic cascaded updating (DELETE is allowed, + but not UPDATE) of the same table, as this can lead to an infinite + cycle. Check that we are not updating the same table which is + already being modified in this cascade chain. We have to check + this also because the modification of the indexes of a 'parent' + table may still be incomplete, and we must avoid seeing the indexes + of the parent table in an inconsistent state! */ - if (!node->is_delete + if (!cascade->is_delete && row_ins_cascade_ancestor_updates_table(cascade, table)) { /* We do not know if this would break foreign key |