Re: WITH RECUSIVE patches 0723

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Tatsuo Ishii" <ishii(at)postgresql(dot)org>, <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WITH RECUSIVE patches 0723
Date: 2008-07-28 16:33:29
Message-ID: 878wvmt1d2.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)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!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-07-28 16:44:24 Re: WITH RECUSIVE patches 0723
Previous Message Joshua D. Drake 2008-07-28 16:19:05 Re: Python 2.5 vs the buildfarm

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-07-28 16:44:24 Re: WITH RECUSIVE patches 0723
Previous Message Andrew Dunstan 2008-07-28 16:06:17 Re: [PATCHES] odd output in restore mode