in reply to Re: SQL question: Insertion with FK constraint
in thread SQL question: Insertion with FK constraint

This is completely incorrect for any version of MySQL 4+. 3.23 had this problem. It's been fixed.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re^2: SQL question: Insertion with FK constraint

Replies are listed 'Best First'.
Re^3: SQL question: Insertion with FK constraint
by perrin (Chancellor) on Jun 26, 2008 at 16:34 UTC
    From the docs for 5.0:
    The inline REFERENCES specifications where the references are defined as part of the column specification are silently ignored by InnoDB. InnoDB only accepts REFERENCES clauses when specified as part of a separate FOREIGN KEY specification.
      Bah. I've done this before and it worked.

      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
        Sorry, I don't think so. Try it. You won't get a parse error, but you won't get foreign key constraints either. The docs are correct.