Re: recursive query crash - Mailing list pgsql-hackers

From Tom Lane
Subject Re: recursive query crash
Date
Msg-id 2351.1223778104@sss.pgh.pa.us
Whole thread Raw
In response to Re: recursive query crash  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: recursive query crash
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> I'm inclined to prevent this case by forbidding recursive references
>> inside nested WITH clauses.  Thoughts?

> I'm a bit puzzled where the root of the problem lies here. Surely the nested
> with clause is just equivalent to a plain "select * from z" after all.

If we were to flatten it to a plain "select * from z" then maybe things
would work all right, but the present implementation treats both WITH
clauses as equally requiring single evaluation.

I don't find the flattening argument to be especially compelling
anyway.  Suppose that the query containing the nested WITH refers
to the WITH query more than once (or more than twice, or whatever
your threshold of pain is before you agree that single evaluation is
required).  Should the query suddenly become invalid at that point?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Vladimir Sitnikov"
Date:
Subject: Re: Buffer pool statistics in Explain Analyze
Next
From: Ron Mayer
Date:
Subject: Re: The Axe list