3 ms·
Doesn’t feel natural in Postgres. I’d check an auxiliary table nodes_nodes (integer, integer) having an index of all ancestor-descendants.
by SnowHill9902 4y ago
Doesn’t feel natural in Postgres. I’d check an auxiliary table nodes_nodes (integer, integer) having an index of all ancestor-descendants.
- evv 4y agoAgree its a bit unnatural, but it seems workable. My problem with the auxiliary table is, I wouldn't know how to implement the unique constraint.
- SnowHill9902 4y agoIn your current implementation you either have no unique constraint or it is a more particular case of UNIQUE(ancestor, descendant).