List:General Discussion« Previous MessageNext Message »
From:Heikki Tuuri Date:December 17 2003 10:35pm
Subject:Re: foreign keys.
View as plain text  
Mofeed,

----- Original Message ----- 
From: "Mofeed Shahin" <mofeed.shahin@stripped>
To: "Heikki Tuuri" <Heikki.Tuuri@stripped>; <mysql@stripped>
Sent: Thursday, December 18, 2003 12:20 AM
Subject: Re: foreign keys.


> Hmmm, Thanks for that.
> But I'm not quite sure what it means.
>
> Mof.
>
> ------------------------
> LATEST FOREIGN KEY ERROR
> ------------------------
> 031218  8:48:23 Error in foreign key constraint of table moftest/foo,
> FOREIGN KEY (First_Name, Last_Name) REFERENCES Blah (First_Name,
Last_Name))
> TYPE=INNODB
> Cannot resolve column name close to:
> , Last_Name)) TYPE=INNODB

does the table Blah have the columns First_Name and Last_Name?

Best regards,

Heikki Tuuri
Innobase Oy
http://www.innodb.com
Foreign keys, transactions, and row level locking for MySQL
InnoDB Hot Backup - hot backup tool for InnoDB which also backs up MyISAM
tables

Order MySQL technical support from https://order.mysql.com/


> On Thu, 18 Dec 2003 08:02 am, Heikki Tuuri wrote:
> > Mofeed,
> >
> > if you are using a relatively recent version of 4.0, or 4.1.1, please
look
> > with
> >
> > SHOW INNODB STATUS\G
> >
> > what is the latest FOREIGN KEY error.
> >
> > Best regards,
> >
> > Heikki Tuuri
> > Innobase Oy
> > http://www.innodb.com
> > Foreign keys, transactions, and row level locking for MySQL
> > InnoDB Hot Backup - hot backup tool for InnoDB which also backs up
MyISAM
> > tables
> >
> > Order MySQL technical support from https://order.mysql.com/
> >
> > ----- Original Message -----
> > From: "Mofeed Shahin" <mofeed.shahin@stripped>
> > Newsgroups: mailing.database.myodbc
> > Sent: Wednesday, December 17, 2003 1:19 AM
> > Subject: Re: foreign keys.
> >
> > > mysql> CREATE TABLE foo (
> > >     ->          ID INT PRIMARY KEY,
> > >     ->          note VARCHAR(50),
> > >     ->          First_Name VARCHAR(50),
> > >     ->          Last_Name VARCHAR(50),
> > >     ->          FOO_ID INT,
> > >     ->          INDEX(FOO_ID),
> > >     ->          INDEX(First_Name, Last_Name),
> > >     ->          FOREIGN KEY (FOO_ID) REFERENCES foo(ID),
> > >     ->          FOREIGN KEY (First_Name, Last_Name) REFERENCES Blah
> > > (First_Name, Last_Name)
> > >     ->          ) TYPE=INNODB;
> > > ERROR 1005: Can't create table './moftest/foo.frm' (errno: 150)
> > >
> > > Mof.
> > >
> > > On Tue, 16 Dec 2003 07:54 pm, Victoria Reznichenko wrote:
> > > > Mofeed Shahin <mofeed.shahin@stripped> wrote:
> > > > > Still doesn't work.... But thanks for trying.
> > > >
> > > > Worked fine for me:
> > > >
> > > > mysql> CREATE TABLE Blah (
> > > >     ->         ID INT PRIMARY KEY,
> > > >     ->         Fname VARCHAR (50),
> > > >     ->         Lname VARCHAR (50),
> > > >     ->         UNIQUE (Fname, Lname)
> > > >     -> ) TYPE=INNODB;
> > > > Query OK, 0 rows affected (0.11 sec)
> > > >
> > > > mysql> CREATE TABLE foo (
> > > >     -> ID INT PRIMARY KEY,
> > > >     -> note VARCHAR(50),
> > > >     ->  Fname VARCHAR(50),
> > > >     -> Lname VARCHAR(50),
> > > >     -> FOO_ID INT,
> > > >     -> INDEX(FOO_ID),
> > > >     -> INDEX(Fname, Lname),
> > > >     -> FOREIGN KEY (FOO_ID) REFERENCES foo(ID),
> > > >     -> FOREIGN KEY (Fname, Lname) REFERENCES Blah (Fname, Lname)
> > > >     -> ) TYPE=INNODB;
> > > > Query OK, 0 rows affected (0.10 sec)
> > > >
> > > > > Mof.
> > > > >
> > > > > On Tue, 16 Dec 2003 11:40 am, Aftab Jahan Subedar wrote:
> > > > >> If you have foreign key then add a key for each,
> > > > >> so the
> > > > >>
> > > > >>  > CREATE TABLE foo (
> > > > >>  >    ID INT PRIMARY KEY,
> > > > >>  >    note VARCHAR(50),
> > > > >>  >    Fname VARCHAR(50),
> > > > >>  >    Lname VARCHAR(50),
> > > > >>  >    FOO_ID INT,
> > > > >>  >    INDEX(FOO_ID),
> > > > >>
> > > > >>        KEY(Fname,Lname), #here this one--if it does not
> work,its
not
> >
> > me
> >
> > > > >>  >    FOREIGN KEY (FOO_ID) REFERENCES foo(ID),
> > > > >>  >    FOREIGN KEY (Fname, Lname) REFERENCES Blah (Fname,
> Lname)
> > > > >>  > ) TYPE=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
> > > >  / /|_/ / // /\ \/ /_/ / /__   Victoria.Reznichenko@stripped
> > > > /_/  /_/\_, /___/\___\_\___/   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/mysql?unsub=1
>

Thread
foreign keys.Mofeed Shahin15 Dec
  • Re: foreign keys.Paul DuBois15 Dec
    • Re: foreign keys.Mofeed Shahin15 Dec
      • Re: foreign keys.Victoria Reznichenko15 Dec
        • Re: foreign keys.Mofeed Shahin15 Dec
          • Re: foreign keys.Aftab Jahan Subedar16 Dec
            • Re: foreign keys.Chris Nolan16 Dec
              • Re: foreign keys.Mofeed Shahin16 Dec
            • Re: foreign keys.Mofeed Shahin16 Dec
              • Re: foreign keys.Victoria Reznichenko16 Dec
                • Re: foreign keys.Mofeed Shahin17 Dec
                  • Re: foreign keys.Victoria Reznichenko17 Dec
                    • Re: foreign keys.Mofeed Shahin17 Dec
      • RE: foreign keys.Bob Loeffler15 Dec
Re: foreign keys.Heikki Tuuri17 Dec
  • Re: foreign keys.Mofeed Shahin17 Dec
Re: foreign keys.Heikki Tuuri17 Dec
  • Re: foreign keys.Mofeed Shahin17 Dec
Re: foreign keys.Heikki Tuuri18 Dec
  • Re: foreign keys.Mofeed Shahin18 Dec