我具有以下结构:
CREATE TABLE users (
id bigserial PRIMARY KEY,
parent_id bigint REFERENCES users(id),
left_id bigint REFERENCES users(id) UNIQUE,
right_id bigint REFERENCES users(id) UNIQUE,
);
left_id
值不能包含在right_id
的任何行中
right_id
值不能包含在right_id
的任何行中
如何为这种情况创建约束?