Re: WITH RECUSIVE patches 0723 - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: WITH RECUSIVE patches 0723
Date
Msg-id 878wvmt1d2.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: WITH RECUSIVE patches 0723  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: WITH RECUSIVE patches 0723  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> I think what this is saying is that the subquery defined by a WITH
> clause is to be evaluated only once, even if it is referenced in
> multiple places in the upper query.  This is sensible because if there
> is no such rule, then there really is no semantic difference between
> non-recursive WITH and ordinary subqueries; and the SQL committee is not
> known for inventing duplicate syntax.  

Well I guess that answers the question of whether to apply the partial patch
before full recursive queries come along. In any case since that work seems to
be making a lot of progress (no thanks to me:( ) I don't think it's a problem
to wait.

> This isn't going to be a particularly simple fix :-(.  The basic
> implementation clearly ought to be to dump the result of the subquery
> into a tuplestore and then have the upper level read out from that.
> However, we don't have any infrastructure for having multiple
> upper-level RTEs reference the same tuplestore.

Uhm, indeed, isn't that the whole point of the work needed to make recursive
queries work? Once we have that we'll just use those executor nodes even for
non-recursive queries.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's RemoteDBA services!


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Python 2.5 vs the buildfarm
Next
From: Tom Lane
Date:
Subject: Re: WITH RECUSIVE patches 0723