Re: recursive query crash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Postgres <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: recursive query crash
Date: 2008-10-12 02:21:44
Message-ID: 2351.1223778104@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron Mayer 2008-10-12 02:38:06 Re: The Axe list
Previous Message Vladimir Sitnikov 2008-10-12 01:01:20 Re: Buffer pool statistics in Explain Analyze