Have an interesting situation: I have a foreign key from a.name (child table) to b.name (parent table). b.name does not have a unique constraint on it, so it may contain duplicate values.
If I put the name 'bob' in b.name twice, and then put it in a.name, I can no longer delete or update either instance of 'bob' in table b. In both cases, it complains that by deleting/updating the row in table b, the FKey linking a.name to b.name will fail.
Now this makes some sense, but I want to be able to tell the FKey to only fail if there is no other instance 'bob' in table b. So if I have multiple instances of 'bob' in b.name, I can change/delete any except for the last one.
[Note that doing the obvious and adding a unique constraint on b.name won't work because it will cause 'undefined behavior' in an application I didn't write]
Any ideas?