Bug #22387 Documentation on FKs doesnt mention that an FK should refer to an index
Submitted: 15 Sep 2006 11:08 Modified: 15 Sep 2006 11:36
Reporter: Vladimir Kolesnikov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.0.x OS:
Assigned to: CPU Architecture:Any

[15 Sep 2006 11:08] Vladimir Kolesnikov
Description:
Documentation on FKs doesnt mention that an FK should refer to an index - not just a column. (At least I didnt find where it's mentioned)

How to repeat:
Look into the topic about FKs
[15 Sep 2006 11:17] Valeriy Kravchuk
Vladimir,

Sorry, what is NOT clear (or incorreect) here (http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html)?

" Foreign keys definitions are subject to the following conditions:
...
-      In the referencing table, there must be an index where the foreign key columns are listed as the first columns in the same order. Such an index is created on the referencing table automatically if it does not exist.
-      In the referenced table, there must be an index where the referenced columns are listed as the first columns in the same order.
..."

Foreign key in all RDBMSes I know references to COLUMNs, not to INDEXes, even if that columns have PRIMARY KEY (or UNIQUE INDEX) defined on them.
[15 Sep 2006 11:36] Vladimir Kolesnikov
thx for pointing me to the right location