Heikki,
        I did end up reading that bit before you sent this to the list, but before I 
could send the follow up I wanted. I have added the creation of the index to 
my create statement, but I get the same error. Here is the sql as it stands 
now:


CREATE TABLE `user` (
  `user_id` int(11) NOT NULL auto_increment,
  `username` varchar(30) NOT NULL default '',
  `firstname` varchar(30) NOT NULL default '',
  `lastname` varchar(30) NOT NULL default '',
  `email` varchar(100) NOT NULL default '',
  `password` char(16) NOT NULL default '',
  `admin` char(1) NOT NULL default 'N',
  PRIMARY KEY  (`user_id`),
  UNIQUE KEY `username` (`username`)
) TYPE=innodb

CREATE TABLE `wishlist` (
                `wishlist_id` int(11) NOT NULL auto_increment,
                `user_id` int(11) NOT NULL,
                PRIMARY KEY (`wishlist_id`),
                INDEX `wishlist_user_id_ind` (`user_id`),
                FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
                ) TYPE = innodb

Thanks,
Patrick

On Monday 24 December 2001 1:02, you wrote:
> Patrick,
>
> >I wasn't on the list when the thread below started, but I saw it on google
> >and wanted to add some more information, but this time, my columns aren't
> >char based and I get the same error. Here's my SQL:CREATE TABLE `user` (
> >  `user_id` int(11) NOT NULL auto_increment,
> >  `username` varchar(30) NOT NULL default '',
> >  `firstname` varchar(30) NOT NULL default '',
> >  `lastname` varchar(30) NOT NULL default '',
> >  `email` varchar(100) NOT NULL default '',
> >  `password` varchar(8) NOT NULL default '',
> >  `admin` char(1) NOT NULL default 'N',  PRIMARY KEY  (`user_id`),
> >  UNIQUE KEY `username` (`username`)) TYPE=innodb
> >CREATE TABLE `wishlist` (
> >                `wishlist_id` int(11) NOT NULL auto_increment,
> >                `user_id` int(11) NOT NULL,
> >                PRIMARY KEY (`wishlist_id`),
> >                FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
> >                ) TYPE = innodb
>
> you must explicitly create an index on user_id in table wishlist. This is
> mentioned in the manual. Both the referenced column and referring column
> must appear as the first column in an index.
>
> >I am hoping I am just making some strange mistake. Also of note, I created
> >the wishlist table once before without the foreign key constraint and
> > dropped it. I have read that there might be some problems there too, but
> > if I take out the Foreign Key constraint it creates the wishlish table
> > which leads me to believe this isn't that problem.
> >
> >Thanks,
> >Patrick Burleson
>
> Regards,
>
> Heikki Tuuri
> Innobase Oy
> ---
> Order commercial MySQL/InnoDB support at https://order.mysql.com/
> See http://www.innodb.com for the online manual and latest news on InnoDB
>
>
>
> ---------------------------------------------------------------------
> 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

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