From 51c80faed237cabd9851463b3fabdc3e46800247 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Sun, 21 Jul 2002 12:58:14 +0300 Subject: 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/row/row0ins.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'innobase/row/row0ins.c') 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 -- cgit v1.2.1