I've just come across a table in production which has 4 foreign key constraints. Two of the constraints are exact duplicates of the other two.
ie
fk1(a_id) references a(id)
fk2(a_id) references a(id)
fk3(b_id) references b(id)
fk4(b_id) references b(id)
I have never seen this before ... it strikes me as being quite wrong and my gut feeling is there must be a performance hit here (esp on inserting in to this table). In this instance the database is PostGres but I'm interested in what people think the general behaviour would be.
And if anyone's experienced a time where you'd want foreign keys like this I'd also be interested - especially because I'm going to suggest getting rid of the duplicates!