Re:Postgres 15 improves UNIQUE and NULL
by SnowHill9902 on Monday July 11, 2022 @08:30AM
(#32055262)
Doesn’t feel natural in Postgres. I’d check an auxiliary table nodes_nodes (integer, integer) having an index of all ancestor-descendants.
[ Parent
| on HN ]
Agree 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.
Re:Postgres 15 improves UNIQUE and NULL
by SnowHill9902 on Monday July 11, 2022 @05:26PM
(#32062109)
In your current implementation you either have no unique constraint or it is a more particular case of UNIQUE(ancestor, descendant).