Re: [SQL] Utility of recursive queries?

2004-04-09 Thread Tom Lane
James Robinson <[EMAIL PROTECTED]> writes: > Given a reference to id=3, would a recursive query be the trick to > unrolling the list to discover id=1 as the head using a SQL one-liner? I think you could do it, but don't have the syntax in my head. > would any potential recursive query implement

Re: [SQL] Utility of recursive queries?

2004-04-09 Thread Josh Berkus
James, > Would recursive queries be the trick to doing things like unwinding a > linked-list to either the head or tail, with: Yes. Also check out contrib/ltree and contrib/tablefunc in your handy-dandy PostgreSQL source code. -- Josh Berkus Aglio Database Solutions San Francisco ---

[SQL] Utility of recursive queries?

2004-04-09 Thread James Robinson
Would recursive queries be the trick to doing things like unwinding a linked-list to either the head or tail, with: create table list ( id int primary key, parent int references list(id) ); insert into list values (1, null); -- head of