PostgreSQL ltree 查找给定路径的所有子节点(不使用表达式)

PostgreSQL ltree find all child node of a given path (With out using expression)

给定路径的唯一子节点(给定路径除外)

查询:

select path from tree where path <@ 'a.b.c';

结果:

预期结果:

a.b.c以下所有节点(结果不需要a.b.c)

明确排除确切值怎么样?

select path 
from tree 
where path <@ 'a.b.c' and path <> 'a.b.c'

或者,您可以使用:

select path 
from tree
where path ~ 'a.b.c.*{1}'