Re: [SQL] WITH RECURSION output ordering with trees

2009-07-10 Thread Philippe Lang
pgsql-sql-ow...@postgresql.org wrote: > In article > , > "Philippe Lang" writes: > >> Thanks for your answer. Si there a built-in function that would allow >> generating the sort path based on the value of the lookup column, >> instead of the id, which has no meaning at all? > >> If yes, we wou

Re: [SQL] WITH RECURSION output ordering with trees

2009-07-10 Thread Harald Fuchs
In article , "Philippe Lang" writes: > Thanks for your answer. Si there a built-in function that would allow > generating the sort path based on the value of the lookup column, > instead of the id, which has no meaning at all? > If yes, we would get instead: > depth | id | lookup | parent_id

Re: [SQL] WITH RECURSION output ordering with trees

2009-07-10 Thread Philippe Lang
pgsql-sql-ow...@postgresql.org wrote: > Philippe Lang, 10.07.2009 11:10: >> Hi, >> >> I'm playing with the new "WITH RECURSIVE" feature of 8.4. I'm trying >> to figure out how to use it with trees. >> >> Here is the test code I use: >> >> I'd like to perform a real recursion, and show the tree s

Re: [SQL] WITH RECURSION output ordering with trees

2009-07-10 Thread Thomas Kellerer
Philippe Lang, 10.07.2009 11:10: Hi, I'm playing with the new "WITH RECURSIVE" feature of 8.4. I'm trying to figure out how to use it with trees. Here is the test code I use: I'd like to perform a real recursion, and show the tree structure in a more appopriate way, like this: Any idea how to

Re: [SQL] WITH RECURSION output ordering with trees

2009-07-10 Thread Philippe Lang
pgsql-sql-ow...@postgresql.org wrote: > Hi, > > I'm playing with the new "WITH RECURSIVE" feature of 8.4. I'm trying > to figure out how to use it with trees. > > Here is the test code I use: > > - > --DROP TABLE recursion; > > CREATE TAB

[SQL] WITH RECURSION output ordering with trees

2009-07-10 Thread Philippe Lang
Hi, I'm playing with the new "WITH RECURSIVE" feature of 8.4. I'm trying to figure out how to use it with trees. Here is the test code I use: - --DROP TABLE recursion; CREATE TABLE recursion ( id serial, lookup varchar(16), parent_id