Hi all,

It seems that some is misunderstanding my problem, so i try to re-write my problem 
again.


I just wonder. I have tried this example from www.mysql.org Doc.
 
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 SET NULL
) TYPE=INNODB;

But, the constraint does not work propperly. If i add 1 and 2 in the parent table like 
this:

insert into parent values (1);
insert into parent values (2);

and  1,1 and 1,6 in the child table, like this:

insert into child values (1,1);
insert into child values (1,6);

, it still works !!!!!!

What i know, is that the constraint is voilated if i insert the last insert statement 
(insert into child values (1,6)), because 6 is NOT in the parent table!!!!

BTW: Any value is accepted in the child table - Thats Strange!!!
 
Does anyone know if there is a Bug in the mysql, or im just getting it all wrong???? 
If you know howto make the constraints work please write a little example - Thanks  :-)
 
Regards
Frank Jørgensen
 



---------------------------------------------------------------------
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

Reply via email to