Toad World® Forums

Foreign Key error


I’m using TDM

I tried to define an identifying relationship. The foreign key that it generates contains more than the primary key from the parent entity.

In the attached image, you can see that Entity6 has both columns a and x in the foreign key to Entitty4. I would expect the FK to Entity4 to contain only column a.

Here is the SQL generated for the FK:

ALTER TABLE Entity6 ADD CONSTRAINT Relationship11 FOREIGN KEY (a, x) REFERENCES Entity4 (a, x)

I couldn’t figure out how to remove x from this FK.




You can try using the foreign key mapping feature. Double click on Relationship11 and then goto Foreign Keys tab. Change the child to a for both parent (a, x).



Thank you for your help. It was my very foolish mistake. The column x was part of the primary key, indeed. I changed that and the relationship worked as I expected.