[snip] > > I do not know how you can have one column that contains foreign keys to > two different columns, whether they are in the same table or not. What > db supports this and what is the sql syntax? How do you know if a > particular entry contains data related to a particular column? > > You are free to do something like this and write code to figure out the > logic, but I do not see how you can describe it in a relational way, so > that torque or any other OR-mapping tool could handle it automatically. > > john mcnally
Ok...here's a scenario, which makes things somewhat more explicit. In an application, there are users and groups. These implement a Principal interface. An access control list stores the access rights to a principal (users/groups). How would these map to a relational model? Probably a User and Group table. Certainly an AccessControlList table as well. One of the columns in AccessControlList need to mapped to the pKey of a principal, whether it is from User or Group. This relationship does not need to be enforced through a foreign key relationship, but it should ideally be expressed somehow. I guess one way to approach this is create a Principal table which stores all the pKeys of both User and Group, but it seems awfully inefficient to me to do so. But doing this allows one to create a foreign key in AccessControlList. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
