I am using PostgreSQL and ltree for constructing a large set of binary tree data. For a particular logic I have to get the left/right most path of a given node.
Sample of my Binary tree
Sample of my table content
Sample input and expected output:
Input - node 1, left most children
Output - 1, 1.L2, 1.L2.L3,... (Only the outer left most children)
I would like to get this result in postgresql, ltree query.
Please help me to solve this out.
Any better postgre table design can also suggest but the that must get good performance with large amount of data.

