summaryrefslogtreecommitdiff
path: root/innobase/row/row0ins.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2002-07-21 12:58:14 +0300
committerunknown <heikki@hundin.mysql.fi>2002-07-21 12:58:14 +0300
commitb6b2546c18faf4d72a879e5ef756a241144c7018 (patch)
tree81c39a68aa307f4493fbb83c4e27f12460766943 /innobase/row/row0ins.c
parenta9c52ff7172308af72f062a1cae86671cbb1ed7a (diff)
downloadmariadb-git-b6b2546c18faf4d72a879e5ef756a241144c7018.tar.gz
row0ins.c:
Do not perform ON DELETE action for a FOREIGN KEY constraint if we are doing an UPDATE, not a DELETE dict0dict.c: test innobase/dict/dict0dict.c: test innobase/row/row0ins.c: Do not perform ON DELETE action for a FOREIGN KEY constraint if we are doing an UPDATE, not a DELETE
Diffstat (limited to 'innobase/row/row0ins.c')
-rw-r--r--innobase/row/row0ins.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index ee4805d51d2..5badebf2011 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -389,9 +389,21 @@ row_ins_foreign_delete_or_set_null(
char err_buf[1000];
ut_a(thr && foreign && pcur && mtr);
+ ut_a(que_node_get_type(node) == QUE_NODE_UPDATE);
node = thr->run_node;
+ if (!node->is_delete) {
+ /* According to SQL-92 an UPDATE with respect to FOREIGN
+ KEY constraints is not semantically equivalent to a
+ DELETE + INSERT. Therefore we do not perform any action
+ here and consequently the child rows would be left
+ orphaned if we would let the UPDATE happen. Thus we return
+ an error. */
+
+ return(DB_ROW_IS_REFERENCED);
+ }
+
if (node->cascade_node == NULL) {
/* Extend our query graph by creating a child to current
update node. The child is used in the cascade or set null