Subject | Unable to add a foreign key |
---|---|
Author | jlee@rri-medtech.com |
Post date | 2001-02-02T15:20:08Z |
We're in the process of migrating a system from Oracle to Interbase
for a demo system, and we're running into trouble creating the tables.
We took an Oracle export, ripped out the Oracle-eze, and fixed up the
SQL to make it work with Interbase. Basically, it follows this pattern:
create table...
add primary key
creat table...
...
...
alter table add foreign key...
alter table add foreign key...
The problem I'm having is that at seemingly random times (random from
script to the next), the script fails during the long list of alter
table statements. In one script, I merely reordered the alter tables
and it worked. In another, I can't get it to work. It would help if
I understood why reordering the first script worked. As things stand
now, I'm totally guessing. At any rate, here's the error message:
Unsuccessful metadata update
STORE RDB$REF_CONSTRAINTS failed
action cancelled by trigger (1) to preserve data integrity
Name of Referential Constraint not defined in constraints table
Statement: ALTER TABLE FLOWINFO ADD CONSTRAINT FK_FLOWID_FLOWINFO
FOREIGN KEY (PK_FLOWID) REFERENCES FLOWID (PK_FLOWID)
I've checked everything I can think of. Both tables exist. The
columns are named correctly. The referenced column is defined as not
null (it's actually the primary key). Where it says "Name of
Referential Constraint not defined in constraints table" really has me
thinking that it's not necessarily a syntax problem. Any clues? If
you need to the script I can trim it down to just what you need.
Lemme know. Thanks a lot!
--
Jason Lee | Konqueror was developed as a counterpunch to sawfish?
Programmer | I guess cars were developed in response to tapioca. --
dinotrac
for a demo system, and we're running into trouble creating the tables.
We took an Oracle export, ripped out the Oracle-eze, and fixed up the
SQL to make it work with Interbase. Basically, it follows this pattern:
create table...
add primary key
creat table...
...
...
alter table add foreign key...
alter table add foreign key...
The problem I'm having is that at seemingly random times (random from
script to the next), the script fails during the long list of alter
table statements. In one script, I merely reordered the alter tables
and it worked. In another, I can't get it to work. It would help if
I understood why reordering the first script worked. As things stand
now, I'm totally guessing. At any rate, here's the error message:
Unsuccessful metadata update
STORE RDB$REF_CONSTRAINTS failed
action cancelled by trigger (1) to preserve data integrity
Name of Referential Constraint not defined in constraints table
Statement: ALTER TABLE FLOWINFO ADD CONSTRAINT FK_FLOWID_FLOWINFO
FOREIGN KEY (PK_FLOWID) REFERENCES FLOWID (PK_FLOWID)
I've checked everything I can think of. Both tables exist. The
columns are named correctly. The referenced column is defined as not
null (it's actually the primary key). Where it says "Name of
Referential Constraint not defined in constraints table" really has me
thinking that it's not necessarily a syntax problem. Any clues? If
you need to the script I can trim it down to just what you need.
Lemme know. Thanks a lot!
--
Jason Lee | Konqueror was developed as a counterpunch to sawfish?
Programmer | I guess cars were developed in response to tapioca. --
dinotrac