On Wednesday 12 February 2003 18:26, Ben Clewett wrote:

> I am using 4.0.10-gamma-max-nt, with 100% innodb, and cannot get Foreign
> Keys to create.
>
> The help files give this example:
>
> 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;
>
> My syntax is:
>
> create table if not exists sub (
>       code varchar(8) primary key,
>       name varchar(30) not null,
>       notes text,
>       sup varchar(8) not null,
>       index i_sup (sup),
>       foreign key (sup) references sup(code) on delete set null
                                                ^^^^

If you mean 'sub', look at your CREATE TABLE statement , you defined column 
'sup' as NOT NULL and in the same time you specified ON DELETE SET NULL in 
the FOREIGN KEY CONSTRAINT definition ..

> ) type=innodb;
>
> I get:
>
> MySql Error: Could not execute command [create table if not exists sub (
> code varchar(8) primary key, name varchar(30) not null, notes text, sup
> varchar(8) not null, index i_sup (sup), foreign key (sup) references
> sup(code) on delete set null ) type=innodb;] on server because: Can't
> create table '.\rr\sub.frm' (errno: 150)
>
> Which is very annoying, as I can't move on from here...
>
> The error message is really no help.  It will have no problem creating
> the listed file (.\rr\sub.frm) if there is no foreign key in the schema.
>
> I am sure there is not problem with MySQL or everybody would have
> complained long ago, so it must be me being stupid...  Somewhere...





-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




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