Description:
I have created a foreign key. Setted ON DELETE and ON UPDATE settings to SET NULL. Everything works fine. I can insert and delete foreign key nicely. It is automatically sets the key null on child table.
When I restarted the mysql server, I have observed that the settings of the foreign key is automatically setted to RESTRICT.
How to repeat:
Use following dump. Monitor foreign key settings on table named a. Restart the mysql server. Monitor foreign key on table a.
-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version 5.1.14-beta-community-nt
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
--
-- Create schema deneme
--
CREATE DATABASE IF NOT EXISTS deneme;
USE deneme;
--
-- Definition of table `a`
--
DROP TABLE IF EXISTS `a`;
CREATE TABLE `a` (
`ida` bigint(20) NOT NULL AUTO_INCREMENT,
`idb` bigint(20) DEFAULT '0',
PRIMARY KEY (`ida`),
KEY `FK_ALIM_ISLEMID` (`idb`) USING BTREE,
CONSTRAINT `FK_a_1` FOREIGN KEY (`idb`) REFERENCES `b` (`idb`) ON DELETE SET NULL ON UPDATE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='InnoDB free: 22528 kB; (`KullaniciID`) REFER `yhticari/kulla';
--
-- Dumping data for table `a`
--
/*!40000 ALTER TABLE `a` DISABLE KEYS */;
/*!40000 ALTER TABLE `a` ENABLE KEYS */;
--
-- Definition of table `b`
--
DROP TABLE IF EXISTS `b`;
CREATE TABLE `b` (
`idb` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`idb`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;
--
-- Dumping data for table `b`
--
/*!40000 ALTER TABLE `b` DISABLE KEYS */;
/*!40000 ALTER TABLE `b` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;