3 ms·
Following http://stackoverflow.com/questions/3438066/check-constraint-on-multiple-columns http://stackoverflow.com/questions/3438066/check-constraint-..., and a
by Someone 14y ago
Following http://stackoverflow.com/questions/3438066/check-constraint-on-multiple-columns http://stackoverflow.com/questions/3438066/check-constraint-..., and assuming that ID's get doled out in increasing order:
create table post (
id int primary_key,
parent_id int references post(id),
CONSTRAINT foo CHECK (id > parent_id)
);