Shared primary key question
I have a table that looks like so:
Now I added a shared primary key to this table that appears like so:
Primary key (friend_a_id, friend_b_id)
However it only checks for duplicate values if the combination is always in the same order.
For example the database allows the following two entries:
I'd like it to reject any COMBINATION of two ids that were already entered into the database. So in my above example if the primary key 13 already exists it should reject an entry of 31.
Is this possible or is it something I need to check via programming before entering data?