From: Date: February 26 2004 3:48pm Subject: Re: Bug in new FOREIGN KEY checks in MySQLInnoDB/4.0.18 List-Archive: http://lists.mysql.com/bugs/15256 Message-Id: <16446.1832.777539.166765@sinisa.nasamreza.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Steve Hay writes: > Hi, > > I've just upgraded from MySQL 4.0.16 to 4.0.18 and now find that some > commands that used to work without error (dropping and re-creating a > database) no longer work. > > The error is: > > error: 'Cannot delete or update a parent row: a foreign key > constraint fails' > > which presumably relates to the first item in the InnoDB version history > (http://www.innodb.com/ibman.php#InnoDB.history). (All the tables in > the database concerned are InnoDB tables.) > > It appears that the foreign key constraint is being checked even when > dropping the database, which I assume is not intended. > > I tried a simple case of one table X referencing another table Y, and > "DROP DATABASE" works fine (even with data in it, so foreign key > constraints are not being checked here, which is as I would expect). I > tried another case with two tables X and Y referencing one table Z, but > still no error. Finally, I reproduced my problem by having table X > referencing table Y and table Y referencing table Z. > > The following DOS command-lines result in the error above: > > I'm running Windows XP SP1. > > Regards, > - Steve > Hi! Yes, the above is now the expected behaviour and it is documented in our Changelog. All you have to do is drop tables in the right order. -- Sincerely, -- For technical support contracts, go to https://order.mysql.com/?ref=msmi __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic / /|_/ / // /\ \/ /_/ / /__ MySQL AB /_/ /_/\_, /___/\___\_\___/ Full time Developer and Support Coordinator <___/ www.mysql.com Larnaca, Cyprus Meet the MySQL at User Conference ! (April 14-16, 2004) http://www.mysql.com/uc2004/