>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>> I think it needs this change in addition; without it, incorrect>> results are returned when you reference a
recursiveview 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 backTom> and forth looks fundamentally broken to me
anyway;there's justTom> no way it'll be certain to link the right nodes together inTom> 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 WITHTom> 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)