Subject | Unable to re-create foreign key |
---|---|
Author | Ed Dressel |
Post date | 2006-11-14T22:24:05Z |
I've had a database that has shown problems (see
http://tech.groups.yahoo.com/group/firebird-support/message/78918).
I've dropped the foreign keys and primary index that was causing the
problem and re-created the primary index. All is okay--until I try to
re-create a foreign key with:
alter table ACTIONLOG
add constraint FK1_ACTIONLOG
foreign key (CLIENT_ID)
references CLIENTINFO(CLIENT_ID)
I get the following exception:
Cannot commit transaction:
violation of FOREIGN KEY constraint "".
violation of FOREIGN KEY constraint "PK_CLIENTINFO" on table "CLIENTINFO".
I've checked
1) all client_id values in ActionLog are in ClientInfo:
select client_id from ClientLog where not client_id in
(select Client_Id from ClientInfo)
(which returns empty).
2) There are no null client_id values in ActionLog (or ClientInfo).
There is another tables where table.client_id has a fk on ClientInfo
and that one restored the fk just fine.
What might I look at?
Thanks
Ed Dressel
http://tech.groups.yahoo.com/group/firebird-support/message/78918).
I've dropped the foreign keys and primary index that was causing the
problem and re-created the primary index. All is okay--until I try to
re-create a foreign key with:
alter table ACTIONLOG
add constraint FK1_ACTIONLOG
foreign key (CLIENT_ID)
references CLIENTINFO(CLIENT_ID)
I get the following exception:
Cannot commit transaction:
violation of FOREIGN KEY constraint "".
violation of FOREIGN KEY constraint "PK_CLIENTINFO" on table "CLIENTINFO".
I've checked
1) all client_id values in ActionLog are in ClientInfo:
select client_id from ClientLog where not client_id in
(select Client_Id from ClientInfo)
(which returns empty).
2) There are no null client_id values in ActionLog (or ClientInfo).
There is another tables where table.client_id has a fk on ClientInfo
and that one restored the fk just fine.
What might I look at?
Thanks
Ed Dressel