I’m not sure I’ve phrased the question correctly, so I’ll try a longer explanation. I have this kind of table:
CREATE TABLE x (a int, b int);
I want to consider the pair (a,b) to be identical to (b,a), and to disallow insertion of duplicates. If PostgreSQL had a set data type, I might declare the table like this:
CREATE TABLE x (
ab set,
UNIQUE (ab)
);
But it doesn’t, so what’s the best way of doing this?
1 Answer