Re: [SQL] WITH RECURSIVE question

2011-08-23 Thread Julien Cigar
mmh I made a little mistake: it was {A,B} of course, not {A,B,C} On 08/23/2011 12:03, Julien Cigar wrote: given D I want {A,B,C} -- No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced. <> -- Sent via pgsql-sql mailing list (pgsql-sql@pos

[SQL] WITH RECURSIVE question

2011-08-23 Thread Julien Cigar
Hello, I have a classic parent -> child relation (id, container_id) and I would like to find the full hierarchy for a child, something like A / \ B C | D given D I want {A,B,C} WITH RECURSIVE hierarchy(level, container_id, titles, containers) AS (SELECT 1 AS level, container_id, ARRAY[