Re: [PATCHES] WIP: Hierarchical Queries - stage 1 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] WIP: Hierarchical Queries - stage 1
Date
Msg-id 25922.1158933753@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] WIP: Hierarchical Queries - stage 1  (Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>)
List pgsql-hackers
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> writes:
> The main problem I can see with keeping the CTEs outside the rangetable
> is that according to the source, jointree nodes must currently have
> RANGETBLREF nodes as leaf nodes; as I understand it, your suggestion of
> maintaining the CTEs separately would involve something along the lines
> of keeping a separate CTETable and creating some form of CTETBLREF node
> that could be referenced within the jointree.

No, what I'm thinking is that a *reference* to a CTE, from within the
main query's FROM list, would create a "CTERef" RTE and then you'd have
a normal RANGETBLREF node linking to that in the jointree.  This solves
the problem of where do you put the alias: on the RTE.  What's not clear
to me at this point is whether there can be multiple references in a
query to the same CTE --- if there can, I suspect you must have a data
structure like this.

            regards, tom lane

pgsql-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: 8.3 Development Cycle
Next
From: Bruce Momjian
Date:
Subject: Re: 8.3 Development Cycle