I have two columns like these:
A = {1,2,3}; --> Integer[] Type B = 3; --> Integer Type
I would like to UNIQUE constrains this 2 columns of different types.
There is a method to compare all the values of an array with single values in postgres?
P.s (A,B) should be unique
Advertisement
Answer
You cannot create a unique constraint on array elements table-wide. You can create a check constraint that will ensure that array elements are unique within that array.