saiph <[EMAIL PROTECTED]> wrote: > > i'm studing foreign keys but my sql code does not react as > would imagine when i insert inconsistent data. > > i.e. > > create database urls; > use urls; > > create table caths > ( > name varchar(7) primary key > ) type = innodb; > > create table urls > ( > name varchar(10) primary key, > home varchar(30) unique, > cath varchar(7), > constraint fk foreign key(cath) references caths(name) > on update cascade on delete set null > ) type = innodb; > > load data local infile "caths.lst" into table caths; > load data local infile "urls.lst" into table urls; > > why it it possible to insert urls such as: > mysql mysql.com dev-null > > when dev-null in not a value of the attribute caths.name? >
Because your tables are not InnoDB. Check if InnoDB is enabled: SHOW VARIABLES LIKE "have_innodb"; -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]