In Postgres 11 if I add a unique index IX_A_B
on 2 columns (A,B)
is that enough to ensure no duplicate pairs can be inserted
say (5,4) on one row, and (5,4) on another row?
Or... do I need to also add a unique constraint based on the unique index?
ALTER TABLE TBL
ADD CONSTRAINT unique_A_B
UNIQUE USING INDEX IX_A_B;
Also, if I don't need the unique constraint then...
what is the purpose of having such constraints at all?
NOTE: I just tried it, seems the constraint is not needed.
Then I am confused... what is the idea behind unique constraints,
and behind this syntax/command above in particular?