Re: Foreign key constraints - Known issues ?

2007-07-19 Thread Martijn Tonies
>I just wanted to know whether there are any known issues in defining and using Foreign key constraints in MySQL 4 and >MySQL 5. >To be specific, are there any issues on using ON DELETE CASCADE and ON UPDATE CASCADE? > >Would there be any performance issues when we define Foreign key constraints? >

Re: foreign key constraints

2004-07-22 Thread Brian Mansell
Sergei, Check out Paul DuBois' book MySQL - The Definitive Guide (2nd edition). It has a few good chapters that discuss foreign key constraints. --bmansell Brian E. Mansell MySQL Professional On Thu, 22 Jul 2004 13:06:07 -0700, Sergei Skarupo <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'd

Re: Foreign Key Constraints

2004-05-28 Thread Martijn Tonies
> > This makes perfectly sense. > > > > So, once again I dare to ask: what's the problem with NULLable > > Foreign Keys? It works fine :-) > > > > (now, who was it that said that FKs should be entered/exist > > always?) > > > > With regards, > > Here is the issue... > > If you go back to what he w

Re: Foreign Key Constraints

2004-05-28 Thread Jeff Smelser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 28 May 2004 11:50 am, Martijn Tonies wrote: > This makes perfectly sense. > > So, once again I dare to ask: what's the problem with NULLable > Foreign Keys? It works fine :-) > > (now, who was it that said that FKs should be entered/exist > a

Re: Foreign Key Constraints

2004-05-28 Thread Jeff Smelser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 28 May 2004 11:50 am, Martijn Tonies wrote: > This makes perfectly sense. > > So, once again I dare to ask: what's the problem with NULLable > Foreign Keys? It works fine :-) > > (now, who was it that said that FKs should be entered/exist > a

Re: Foreign Key Constraints

2004-05-28 Thread Martijn Tonies
Hi, > > Martijn Tonies wrote: > > > >> Hi Jeff, > >> > > > > > > In this example, inno3.PK_Col references inno2.Child_Col, so the 2nd and > > 3rd statements are failing because they try to set inno3.PK_Col to > > values not present in inno2.Child_Col. The NULLs are irrelevant. Woops, right Mich

Re: Foreign Key Constraints

2004-05-28 Thread Michael Stassen
Michael Stassen wrote: Martijn Tonies wrote: Hi Jeff, In this example, inno3.PK_Col references inno2.Child_Col, so the 2nd and 3rd statements are failing because they try to set inno3.PK_Col to values not present in inno2.Child_Col. The NULLs are irrelevant. Michael Perhaps this is what you

Re: Foreign Key Constraints

2004-05-28 Thread Michael Stassen
Martijn Tonies wrote: Hi Jeff, CREATE TABLE inno2 ( PK_Col Integer NOT NULL DEFAULT 0, Child_Col Integer, PRIMARY KEY (PK_Col) ) TYPE=InnoDB ; CREATE INDEX I_Inno2_ChildCol ON inno2(Child_Col); CREATE TABLE inno3 ( PK_Col Integer NOT NULL DEFAULT 0, Child_Col Integer, PRIMARY KEY (PK_Col) ) TYPE=I

Re: Foreign Key Constraints

2004-05-28 Thread Martijn Tonies
Hi Jeff, > > ok - I've checked. > > > > > > > Why not? What's wrong with this: > > > > > > > > > > BORROWER > > > > > BorrowerID > > > > > > > > > > BOOKS > > > > > BookID > > > > > BorrowerID (nullable) > > > > > > > > > > FK from Books.BorrowerID to Borrower.BorrowerID > > > > > > > > > > I have

Re: Foreign Key Constraints

2004-05-28 Thread Jeff Smelser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 28 May 2004 02:57 am, Martijn Tonies wrote: > Hi, > > ok - I've checked. > > > > > Why not? What's wrong with this: > > > > > > > > BORROWER > > > > BorrowerID > > > > > > > > BOOKS > > > > BookID > > > > BorrowerID (nullable) > > > > > > > >

Re: Foreign Key Constraints

2004-05-28 Thread Martijn Tonies
Hi, ok - I've checked. > > > Why not? What's wrong with this: > > > > > > BORROWER > > > BorrowerID > > > > > > BOOKS > > > BookID > > > BorrowerID (nullable) > > > > > > FK from Books.BorrowerID to Borrower.BorrowerID > > > > > > I haven't checked, but this _should_ be possible. > > > > > > With

Re: Foreign Key Constraints

2004-05-27 Thread Martijn Tonies
Hi, > > Why not? What's wrong with this: > > > > BORROWER > > BorrowerID > > > > BOOKS > > BookID > > BorrowerID (nullable) > > > > FK from Books.BorrowerID to Borrower.BorrowerID > > > > I haven't checked, but this _should_ be possible. > > > > With regards, > > Its a foreign key, you can not nul

Re: Foreign Key Constraints

2004-05-27 Thread Jeff Smelser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 27 May 2004 03:00 am, Martijn Tonies wrote: > Why not? What's wrong with this: > > BORROWER > BorrowerID > > BOOKS > BookID > BorrowerID (nullable) > > FK from Books.BorrowerID to Borrower.BorrowerID > > I haven't checked, but this _should_

Re: Foreign Key Constraints

2004-05-27 Thread SGreen
You could create a special "borrower" account to signify that it is not loaned out and assign that to the book. If this is for a library system (multiple branches) you could create one account for each branch. That way you would know where the book is at all times, "borrowed" or not ;-) Shaw

Re: Foreign Key Constraints

2004-05-27 Thread Martijn Tonies
Hi, > On Wednesday 26 May 2004 11:22 pm, [EMAIL PROTECTED] wrote: > > Hi, I am trying to use the foreign key constraints from InnoDB > > and creating indexes is a requirement for foreign key. > > The problem is that by creating index for my foreign key, > > it does not allow my foreign key to have

Re: Foreign Key Constraints

2004-05-27 Thread Robert J Taylor
[EMAIL PROTECTED] wrote: Hi, I am trying to use the foreign key constraints from InnoDB and creating indexes is a requirement for foreign key. The problem is that by creating index for my foreign key, it does not allow my foreign key to have null or blank values which my records will have. For eg.

Re: Foreign Key Constraints

2004-05-27 Thread Colin Bull
[EMAIL PROTECTED] wrote: Hi, I am trying to use the foreign key constraints from InnoDB and creating indexes is a requirement for foreign key. The problem is that by creating index for my foreign key, it does not allow my foreign key to have null or blank values which my records will have. For eg.

Re: Foreign Key Constraints

2004-05-26 Thread Jeff Smelser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 26 May 2004 11:22 pm, [EMAIL PROTECTED] wrote: > Hi, I am trying to use the foreign key constraints from InnoDB > and creating indexes is a requirement for foreign key. > The problem is that by creating index for my foreign key, > it does

Re: foreign key constraints are driving me crazy!

2004-03-04 Thread Cere M. Davis
In fact it seems to be just to opposite. I toggled the default values to be null and allowed for the null option and "poof" it worked! I don't really understand this very well. Wish I did. > > Some key in the table is null when it shouldnt be, or the type of the join > keys isnt the same. i h

Re: foreign key constraints are driving me crazy!

2004-03-04 Thread daniel
Some key in the table is null when it shouldnt be, or the type of the join keys isnt the same. i have had issues when importing data from a dump so i've had to do a FORIEGN_KEY_CHECKS=0 > > So I have made a table called 'uid' where on uid is the only field in > the table. Then I make another table

Re: foreign key constraints

2003-10-08 Thread Paul DuBois
At 18:22 + 10/8/03, Croniser Brian Contr AFRL/IFGB wrote: Here is the script that creates the database. create table object_attrib (obj_record_id INTEGER(7) AUTO_INCREMENT NOT NULL, PRIMARY KEY (obj_record_id), INDEX (rel_obj_int_id), FOREIGN KEY (rel_obj_int_id) REFERENC

Re: - Foreign key constraints

2002-05-28 Thread Egor Egorov
maxim, Tuesday, May 28, 2002, 4:47:13 PM, you wrote: m> Question. I try to understand with " 4.3 Foreign key constraints " m> InnoDB Engine in MySQL-Max-3.23.50/MySQL-4.0.1. m> I use MySQL Max (InnoDB) 3.23.49 for Win2000 m> I have created two tables: m> CREATE TABLE parent (id INT NOT NULL,

RE: FOREIGN KEY Constraints

2002-04-08 Thread Juan Maunel
Hi, Yes, you are right but be aware with the delete cascade feature, maybe in the way?. Regards - Original Message - From: Carl Schmidt <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, April 07, 2002 7:16 PM Subject: FOREIGN KEY Constraints > From the mysql docs, it looks like

Re: FOREIGN KEY Constraints

2002-04-08 Thread Victoria Reznichenko
Carl, Monday, April 08, 2002, 3:16:26 AM, you wrote: CS> From the mysql docs, it looks like you can only use foreign keys if your CS> tables are type InnoDB. Is this correct? Yes, you are right. In MyISAM tables you can use REFERENCE clause, but it does nothing. CS> Carl -- For t