Toad World® Forums

Foreign Key error


#1

I’m using TDM 3.4.16.7.

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.

Thanks.

tdm.bmp


#2

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).

[cid:image001.png@01CAC780.6DFDEEA0]


#3

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.

-KM