Hi Jeff, it's about time we raised this issue on the list. It was
touched on in a forum thread in December (among many other things in
that discussion with Michał), but never fully explored.
> As I understand it, our current definition of an 'identifying' relationship
> is:
> A foreign key relationship in which the foreign key is part of the primary
> key of the child table.
>
> and a 'non-identifying relationship is:
> A foreign key relationship in which the foreign key is NOT part of the
> primary key of the child table.
This is a special case of our current general definitions. The general
definitions have to allow for keys and relationships involving
multiple columns. So, generalizing your definition, we get:
an 'identifying' relationship is:
A foreign key relationship in which the whole primary key of the
parent table is entirely contained in the primary key of the child
table.
and a 'non-identifying' relationship is:
A foreign key relationship in which the whole primary key of the
parent table is NOT entirely contained in the primary key of the child
table.
That's what the Architect currently means by identifying vs.
non-identifying relationships.
Here are the definitions that I think might be more usual/more correct:
an 'identifying' relationship is:
A foreign key relationship which maps the whole primary key of the
parent table to the child table.
and a 'non-identifying relationship' is:
A foreign key relationship which maps a whole non-PK unique index of
the parent table to the child table.
By these proposed definitions, all relationships generated by the
Architect are identifying relationships. We don't presently have a way
of mapping a set of unique columns other than the PK onto the child
table. However, it should be possible to obtain such a relationship by
reverse engineering.
> The reason I bring it up is because it will affect the fix for bug 1447
> (http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=1447).
> There is a related issue in which non-identifying relationships end up
> getting reverse engineered as identifying relationships.
> (http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=1389)
I'm glad you're looking into this. It's definitely a hole in the
round-trip engineering process, and has been mentioned on the forum by
more than one user.
> The thing is that although I could just set the identifying property based
> on our current definition, would it really be worth it if we're ultimately
> going to change the very definition of 'identifying' vs. 'non-identifying'
> relationships?
Probably not, but if the decision was made by a
detectIdentifyingStatus() method on the SQLRelationship instance, it
would be easy to change. The only bad part would be user annoyance
when the definition of identifying vs. non-identifying changes between
releases.
What's the best way to find out the usual/common/correct definition of
these terms? I don't want to make these changes based on my guess. :)
-Jonathan