ペア (tag1、tag2) と tag_id の間の全単射が必要です。
CREATE TABLE tags (
question_id INTEGER NOT NULL,
tag_id SERIAL NOT NULL,
tag1 VARCHAR(20),
tag2 VARCHAR(20),
PRIMARY KEY(question_id, tag_id),
(tag1, tag2) UNIQUE references tags(tag_id) #How?
);
次のような参照は必要ありません。
(PHP, Perl) points to 1 and 2,
3 points to (C#, null) and (Python, Elinks)
つまり、REFERENCE を UNIQUE(tag1, tag2) ではなく FROM (tag1, tag2) TO tags(tag_id) で一意にしたいということです。