David Fetter <david(at)fetter(dot)org> writes:
> On Wed, Sep 09, 2009 at 03:00:39PM -0400, Tom Lane wrote:
>> David Fetter <david(at)fetter(dot)org> writes:
>>> Should the outer query be able to reference further-in CTEs?
>>
>> No, why would you expect that?
> No particular reason, I suppose. I'm not clear on what the standard
> says about this.
The standard says that the scope of a WITH is the <query expression
body> it precedes.
regards, tom lane