Re: Common Table Expressions (WITH RECURSIVE) patch - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Common Table Expressions (WITH RECURSIVE) patch
Date
Msg-id 87y7221jm9.fsf@oxford.xeocode.com
Whole thread Raw
In response to Common Table Expressions (WITH RECURSIVE) patch  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Common Table Expressions (WITH RECURSIVE) patch  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:

> * Mutual Recursion:
>
>   with recursive
>     foo(i) as (values(1) union all select i+1 from bar where i < 10),
>     bar(i) as (values(1) union all select i+1 from foo where i < 10)
>   select * from foo;
>   ERROR:  mutual recursive call is not supported
>
>   The standard allows mutual recursion.

This seems to be a point of confusion. I originally read the standard and
concluded that mutual recursion was an optional feature. Itagaki-san showed me
a copy of the spec where it seemed there was a clear blanket prohibition on
mutually recursive queries and in fact anything but simple linearly expandable
queries. I wonder if there are different versions of the spec floating around
on this point.

Take a second look at your spec and read on to where it defines "linear" and
"expandable". If it doesn't define those terms then it's definitely different
from what I read. If it does, read on to see what it does with them. The main
reason to define them appeared to be to use them to say that supporting mutual
recursion is not required.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's PostGIS support!


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: A few thoughts on the plan inval extension patch
Next
From: Jeff Davis
Date:
Subject: Re: Common Table Expressions (WITH RECURSIVE) patch