On Thu, Mar 13, 2008 at 7:55 PM, Rob Wultsch <[EMAIL PROTECTED]> wrote: > On Thu, Mar 13, 2008 at 12:33 PM, Yves Goergen > <[EMAIL PROTECTED]> wrote: > > > CREATE TABLE "message" ( > > "MessageId" INTEGER UNSIGNED NOT NULL PRIMARY KEY, > > "Owner" INTEGER UNSIGNED NOT NULL, > > "SearchRevision" INTEGER UNSIGNED) > > ENGINE 'InnoDB' CHARACTER SET 'utf8' COLLATE 'utf8_bin'; > > > > CREATE TABLE "message_revision" ( > > "MessageId" INTEGER UNSIGNED NOT NULL, > > "RevisionNumber" SMALLINT UNSIGNED NOT NULL, > > "Author" INTEGER UNSIGNED NOT NULL, > > PRIMARY KEY ("MessageId", "RevisionNumber")) > > ENGINE 'InnoDB' CHARACTER SET 'utf8' COLLATE 'utf8_bin'; > > > > > > ALTER TABLE "message" ADD FOREIGN KEY ("MessageId", "SearchRevision") > > REFERENCES "message_revision" ("MessageId", "RevisionNumber") ON DELETE > > CASCADE; > > > > > > #1005 - Can't create table '.\unb2test\#sql-770_2.frm' (errno: 150) > > > I am guessing it is an issue with "SearchRevision" being an INTEGER, > and "RevisionNumber" being a SMALLINT.
Yes, that's what is causing the trouble. But that's not all: the UNSIGNED attribute has to match too. (It does in this case, but I'm just pointing it out for future reference). -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]