List:General Discussion« Previous MessageNext Message »
From:Mimi Cafe Date:May 20 2011 11:07am
Subject:MySQL ignores foreign key constraints
View as plain text  
Hi

An ideas why MySQL silently ignores any foreign key constraints I define for
the following tables?  


mysql> desc book;
+------------------+-------------------------------+------+-----+---------+-
------+
| Field            | Type                          | Null | Key | Default |
Extra |
+------------------+-------------------------------+------+-----+---------+-
------+
| pkisbn           | varchar(20)                   | NO   | PRI | NULL    |
|
| fkpublisher_id   | tinyint(3) unsigned           | NO   | MUL | NULL    |
|
| title            | varchar(50)                   | NO   |     | NULL    |
|
| subtitle         | varchar(50)                   | NO   |     | NULL    |
|
13 rows in set (0.01 sec)

mysql> desc book_author;
+-------------+------------------------+------+-----+---------+-------+
| Field       | Type                   | Null | Key | Default | Extra |
+-------------+------------------------+------+-----+---------+-------+
| fkauthor_id | mediumint(10) unsigned | NO   | MUL | NULL    |       |
| fkisbn      | varchar(20)            | NO   | MUL | NULL    |       |
+-------------+------------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> desc author;
+-------------+------------------------+------+-----+---------+-------------
---+
| Field       | Type                   | Null | Key | Default | Extra
|
+-------------+------------------------+------+-----+---------+-------------
---+
| pkauthor_id | mediumint(10) unsigned | NO   | PRI | NULL    |
auto_increment |
| fname       | varchar(20)            | NO   |     | NULL    |
|
| initial     | varchar(5)             | YES  |     | NULL    |
|
| lname       | varchar(20)            | NO   |     | NULL    |
|
+-------------+------------------------+------+-----+---------+-------------
---+
4 rows in set (0.00 sec)


Mimi

Thread
MySQL ignores foreign key constraintsMimi Cafe20 May
  • Re: MySQL ignores foreign key constraintsAndrew Moore20 May
  • Re: MySQL ignores foreign key constraintsSuresh Kuna20 May
    • RE: MySQL ignores foreign key constraintsMimi Cafe20 May