List:General Discussion« Previous MessageNext Message »
From:<daniel Date:March 4 2004 11:20pm
Subject:Re: foreign key constraints are driving me crazy!
View as plain text  
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 called 'users' where there are
> two  fields, 'uid1' and 'uid2' and both uid values have foreign key
> constraints referencing the 'uid' field in the uid table.
>
> No problem, tables are created and are all empty.
>
> Then I try inserting a uid varchar value of 'test' into the uid
> table...
>
> ok works,
>
> Then I try inserting a uid1 and uid2 varchar value of 'test' into the
> users table...
>
> I get a foreign key constraint error or 1216:
>
>  #<MysqlError: Cannot add or update a child row: a foreign key
> constraint fails>
> 1216
>
>
> Does anyone know what I am doing wrong?
>
> Thanks,
> -Cere
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1



Thread
foreign key constraints are driving me crazy!Cere Davis5 Mar
  • Re: foreign key constraints are driving me crazy!daniel5 Mar
    • Re: foreign key constraints are driving me crazy!Cere M. Davis5 Mar