Hi, I am evaluating InnoDB's Foreign Keys and am stuck.
Using the sample tables I want to add records in the Child table with a NULL parent_id (this being referenced to the Parent table) as follows: CREATE TABLE parent(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE) TYPE=INNODB; mysql> insert into parent values(1); Query OK, 1 row affected (0.00 sec) mysql> insert into child (id, parent_id) values(4, 1); Query OK, 1 row affected (0.00 sec) mysql> insert into child (id, parent_id) values(5, null); ERROR 1216: Cannot add a child row: a foreign key constraint fails mysql> insert into child (id) values(5); ERROR 1216: Cannot add a child row: a foreign key constraint fails Is this possible in InnoDB ? Is there a setting that I have missed ? I am using: mysqld-max.exe Ver 4.0.1-alpha-max for Win95/Win98 on i32 Any help will be highly appreciated. Thanks in advance. Ashok Kumar Parmar ISL NZ Limited. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php