Markus,
the problem is that name_id is UNSIGNED in the first table and SIGNED in the
second.
As stated in the manual, integer columns must have the same signedness and
size in a foreign key constraint.
Regards,
Heikki
Innobase Oy
- Original Message -
From: "Markus Lervik" <[EMAIL PROT
on't
agree to these terms, you should return this email in no more than 24 hours
stating the reason of disagreement.
-Oorspronkelijk bericht-----
Van: Markus Lervik [mailto:[EMAIL PROTECTED]]
Verzonden: maandag 10 juni 2002 10:45
Aan: Kiss Dániel
CC: [EMAIL PROTECTED]
Onderwerp: Re: Inno
On Monday 10 Jun 2002 11:44 am, Markus Lervik wrote:
> mysql> show create table ip_name_tbl\G
> *** 1. row ***
>Table: ip_name_tbl
> Create Table: CREATE TABLE `ip_name_tbl` (
[snip]
> `name_id` int(11) NOT NULL default '0',
[snip]
> mysq
On Monday 10 Jun 2002 11:17 am, you wrote:
> First of all the referenced key must be on PRIMARY KEY.
...which means my 'id' -field can't be a primary key, right?
> But I've seen in your table definition a quite strange thing. You have a
> UNIQUE and an ORDINARY key definition on the same field.
Heya!
You need an INDEX.
Try doing this first :
alter table ip_name_tbl add INDEX(name_id);
And add then your constraint.
EG
mysql> SHOW CREATE TABLE ip_name_tbl\G
*** 1. row ***
Table: ip_name_tbl
Create Table: CREATE TABLE `ip_name_tbl
First of all the referenced key must be on PRIMARY KEY.
But I've seen in your table definition a quite strange thing. You have a
UNIQUE and an ORDINARY key definition on the same field.
Here:
...
> UNIQUE KEY `name_id` (`name_id`), <- THIS IS THE FIRST DEFINITION
> UNIQUE KEY `comp_name` (`
Daniel,
- Original Message -
From: "Daniel Rand" <[EMAIL PROTECTED]>
Newsgroups: mailing.database.mysql
Sent: Monday, May 13, 2002 5:24 PM
Subject: InnoDB Foreign Key Constraints
> Hi,
>
> Does anyone know if it's possible to set up a foreign key constraint where
> one table references