Toad World® Forums

Beta and relationships


#1

Perhaps its my naivete regarding the tool and data mining but I see a feature I don’t really care for. I reverse modeled a db that had no relationships created. I created a relationship between a parent table and a child table. The tool created a FK to the parent. I deleted the existing field in the child table that matched the new FK. So far so good. Then I created a child table, perhaps a grand-child table, that is a child of the child. On creating a relationship, I got the a composite key that include the parent of the current table and that tables parent. Not what I was looking for.


#2

Hello,

Let me have some comments.

I reverse modeled a db that had no relationships created. I created a relationship between a parent table and a child table. The tool created a FK to the parent.

Let me quote the documentation:
PFK
As soon as you create an identifying relationship, Toad Data Modeler 3 automatically adds a copy of the primary key of the Parent table to the Child table - Primary Foreign Key (PFK). (The foreign key in Child table is a part of the primary key.)

FK
As soon as you create a non-identifying relationship, Toad Data Modeler 3 automatically adds a copy of the primary key of the Parent table to the Child table - Foreign key (FK). (This foreign key in Child table is not a part of the primary key.)

In other words, foreign keys (PFKs and FKs) are imported from parent entities to child entities automatically when you create a relationship. Foreign keys cannot exist without relationships. Therefore, you are not allowed to delete FK or PFK from Child tables either. To delete them, you have to delete appropriate relationship.

In TDM 3, information on foreign keys can be found in:

  • the Attribute Properties dialog | Foreign Keys tab where you can see details on particular FK.
  • the Relationship Properties dialog | Foreign Keys tab where you set up linking method between parent and child entities.

I deleted the existing field in the child table that matched the new FK.

How did you do it? It’s not possible to delete the FK itself. Possibly, you deleted the relationship. If so, SHIFT+Delete should be used. (Del only removes a shortcut of the relationship from WS, not from the model.)

Flash movie on shortcuts in TDM:
http://modeling.inside.quest.com/entry.jspa?externalID=1669&categoryID=158

Then I created a child table, perhaps a grand-child table, that is a child of the child. On creating a relationship, I got the a composite key that include the parent of the current table and that tables parent. Not what I was looking for.

Possibly, you only removed the relationship instead of deleting it (see the note above).
Anyway, if you do not want the PK to migrate to Entity3, change Rel1 from identifying to non-identifying. Please see the attached screenshot.

If I’ve misunderstood the problem, please write me back. Thanks very much.

Regards,

Vladka
migration_of_keys.png


#3

I played with it a bit more in the Beta and found these problems.

  1. I removed an attribute from PK in Entity1. The workspace did not refresh, although when I see in the Entity 2 and Entity3 Properties dialog, there is no FK attribute.
  • I think this is probably what you wrote about.

This problem is registered under CR # 47 776. We will fix it.
Thanks for your notification.

  1. Also, when I deleted the identifying relationship between Entity1 and 2 (SHIFT+ Del), the FK attribute is still in Entity3. Again, the WS did not refresh properly.
    CR # of this bug is 49 554. We will fix it.

See the attached screenshots.

Thanks for raising up this issue!

Regards,

Vladka
Problems_on_Workspace_Beta.pdf (77.7 KB)