>>>>> "Tom" == Tom Lane <[EMAIL PROTECTED]> writes:

 >> I think it needs this change in addition; without it, incorrect
 >> results are returned when you reference a recursive view from
 >> within the recursive query, due to the RecursionScan nodes
 >> becoming linked to the wrong tuplestores.

 Tom> That whole business of using the EState to pass tuplestores back
 Tom> and forth looks fundamentally broken to me anyway; there's just
 Tom> no way it'll be certain to link the right nodes together in
 Tom> complicated cases with multiple recursions.

Mutual recursion is not allowed; as far as I can determine, every
remaining case is such that any RecursiveScan node should be
referencing the nearest parent Recursion node, which is what the patch
(with the above fix) does.

If you have a counterexample I'd be interested to see it; I've spent a
significant amount of time looking at this code, and I can't find one.

 Tom> The nodes should be carrying IDs (such as the name of the WITH
 Tom> item) which they use to search a lookaside list.

create view v0 as with recursive t(id) as (select ...);
with recursive t(id) as (select ... from v0 ...) select ...;

That gives you two WITH items with the same name. You would need
additional qualification of some sort.

-- 
Andrew (irc:RhodiumToad)

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to