I have this PostgreSQL table with node of a directed graph:
node_id | node_sequence
-----------------------
1 1
2 2
3 3
I'd return a table with all the possible origin destination sequence (only in one direction) between the node: (1,2); (1,2,3); (2,3). So the output table should be:
node_id
----
1
2
1
2
3
2
3
Maybe WITH RECURSIVE is the right thing to do but I cannot understand how.
Edit from initial answer:
You seem to have 2 constraints you do not mention in your question:
Here is a simple query that does it (CTE GraphNode should be replaced with your table):