Subject | foreign key strangeness |
---|---|
Author | Andrew Gough |
Post date | 2003-11-24T06:47:41Z |
Hi All,
I dont know if this is a peculiarity, a known issue, or by design:
I have two tables with a foreign key constraint, as follows:
CREATE TABLE Test1
(
id1 INTEGER NOT NULL,
data1 CHAR(20),
PRIMARY KEY (id1)
);
CREATE TABLE Test2
(
fk2 CHAR(5) NOT NULL,
data2 CHAR(20),
FOREIGN KEY (fk2) REFERENCES Test1 (id1)
);
As you can see, the foreign key is referencing a primary key of a different
data type. When creating these tables, FB does not complain (tested Win2k
FB1.5RC6 & RC7).
The same script in MS SQL fails (as expected).
Andrew Gough
LiveNote Technologies Inc.
I dont know if this is a peculiarity, a known issue, or by design:
I have two tables with a foreign key constraint, as follows:
CREATE TABLE Test1
(
id1 INTEGER NOT NULL,
data1 CHAR(20),
PRIMARY KEY (id1)
);
CREATE TABLE Test2
(
fk2 CHAR(5) NOT NULL,
data2 CHAR(20),
FOREIGN KEY (fk2) REFERENCES Test1 (id1)
);
As you can see, the foreign key is referencing a primary key of a different
data type. When creating these tables, FB does not complain (tested Win2k
FB1.5RC6 & RC7).
The same script in MS SQL fails (as expected).
Andrew Gough
LiveNote Technologies Inc.