4 ms·
Caveat programmer: one of the quirks of ltree is that intermediate paths - which would be parent nodes, when drawn as a tree - are not required to exist. In the
by inopinatus 3y ago
Caveat programmer: one of the quirks of ltree is that intermediate paths - which would be parent nodes, when drawn as a tree - are not required to exist. In the example above, deleting the Top.Science record will not prune the Top.Science.Astronomy record.
So whilst the labels in ltree values do imply a logical tree, by describing materialized paths through it, they do not enforce the presence of records matching all the implied parent nodes.
Depending on your application this may be exactly what you wanted, or exactly what you didn’t want. In the latter case, you’re gonna need to put something around it to maintain integrity.