Skip to content
Advertisement

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

Only child node of given path (Except the given path)

Query:

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

Result:

enter image description here

Expected result:

All the below node of a.b.c (In result don’t needed a.b.c)

Advertisement

Answer

How about explicitly excluding the exact value?

select path 
from tree 
where path <@ 'a.b.c' and path <> 'a.b.c'
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement