On 2016/05/18 5:43 PM, James K. Lowden wrote: > On Wed, 18 May 2016 08:32:24 +0200 > Clemens Ladisch <clemens at ladisch.de> wrote: > >> You get "foreign key mismatch" if you do not have the required >> indexes, i.e., according to a comment in the source, >> 1) The named parent key columns do not exist, or >> 2) The named parent key columns do exist, but are not subject to a >> UNIQUE or PRIMARY KEY constraint, or > Thank you, Clemens. The FK declaration was > > , foreign key (SegName, DbdName) references > Segm(Name, DbdName) > > but the Segm PK was only Name. > > I'm not convinced the requirement that the referenced columns be unique > is justified, but at least now I understand the message. In this case > it uncovered an error, so I got two for the price of one. :-)
Hi James, I'm interested in this statement. I'm not sure that uniqueness is forced, although it has to be an Indexed column, though I could be wrong, and thinking about it more... I am surely wrong - which brings me to my question: How do you see a parent-child relationship possible where the parent is not Unique? How could you cascade to children who doesn't know who their father is specifically and uniquely? Unless perhaps twin fathers are guaranteed to update/delete together and simultaneous (which is never enforceable from the FK perspective). If you think this possible, there must be some mechanism or wisdom I'm deprived of which I would very much like to remedy. Thanks, Ryan