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?
regards, tom lane