Subject | Foreign Key - Problem with Unique constraint |
---|---|
Author | Cam |
Post date | 2012-09-04T10:25:45Z |
FB Version 2.5.1.26351
I have a table (test) with a unique constraint on a field ID_NUMERIC.
CREATE TABLE TEST
( ID BIGINT NOT NULL,
ID_NUMERIC INTEGER NOT NULL,
CONSTRAINT PK_TEST PRIMARY KEY (ID)
);
CREATE UNIQUE ASC INDEX UI_ID_NUMERIC ON TEST (ID_NUMERIC);
Table TESTFK is
CREATE TABLE TESTFK
(
ID BIGINT NOT NULL,
NUMERIC_ID INTEGER NOT NULL,
DESCR VARCHAR( 21) COLLATE NONE,
CONSTRAINT PK_TESTFK PRIMARY KEY (ID)
);
If I try to add a FK ..
ALTER TABLE TESTFK ADD CONSTRAINT TESTFK_FK
FOREIGN KEY (NUMERIC_ID) REFERENCES TEST(ID_NUMERIC)
ON DELETE CASCADE
ON UPDATE CASCADE;
I get the following error.
Script Error:
unsuccessful metadata update
could not find UNIQUE or PRIMARY KEY constraint in table TEST with
specified columns
I'm sure this used to work?
Any help appreciated.
Thanks
Cam
[Non-text portions of this message have been removed]
I have a table (test) with a unique constraint on a field ID_NUMERIC.
CREATE TABLE TEST
( ID BIGINT NOT NULL,
ID_NUMERIC INTEGER NOT NULL,
CONSTRAINT PK_TEST PRIMARY KEY (ID)
);
CREATE UNIQUE ASC INDEX UI_ID_NUMERIC ON TEST (ID_NUMERIC);
Table TESTFK is
CREATE TABLE TESTFK
(
ID BIGINT NOT NULL,
NUMERIC_ID INTEGER NOT NULL,
DESCR VARCHAR( 21) COLLATE NONE,
CONSTRAINT PK_TESTFK PRIMARY KEY (ID)
);
If I try to add a FK ..
ALTER TABLE TESTFK ADD CONSTRAINT TESTFK_FK
FOREIGN KEY (NUMERIC_ID) REFERENCES TEST(ID_NUMERIC)
ON DELETE CASCADE
ON UPDATE CASCADE;
I get the following error.
Script Error:
unsuccessful metadata update
could not find UNIQUE or PRIMARY KEY constraint in table TEST with
specified columns
I'm sure this used to work?
Any help appreciated.
Thanks
Cam
[Non-text portions of this message have been removed]