pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Tatsuo Ishii <ishii@postgresql.org>
Cc: andrew@tao11.riddles.org.uk
Cc: pgsql-hackers@postgresql.org
Subject: Re: WITH RECUSIVE patches 0723
Date: Mon, 28 Jul 2008 12:44:24 -0400
Message-ID: <22969.1217263464@sss.pgh.pa.us> (raw)
In-Reply-To: <878wvmt1d2.fsf@oxford.xeocode.com>
References: <20080725001513.GF16438@fetter.org>
	<20080725.092652.105178884.t-ishii@sraoss.co.jp>
	<87r69gs967.fsf@news-spur.riddles.org.uk>
	<20080728.162925.23020498.t-ishii@sraoss.co.jp>
	<19882.1217256991@sss.pgh.pa.us>
	<878wvmt1d2.fsf@oxford.xeocode.com>

Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> 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?

No, I don't think so.  The present patch (so far as I've gathered what
it can do, in the absence of any documentation) knows how to feed back
tuples collected at an upper level to a scan node at a lower level,
which is needed to implement recursion.  However, if you do

	WITH RECURSIVE foo AS (...) SELECT ... FROM foo a, foo b WHERE

then you will still get two independent evaluations of duplicate
querytrees.  Which is at least a performance bug, and if there are
any volatile functions inside foo I claim it's a spec violation too.

			regards, tom lane



view thread (39+ messages)  latest in thread

Message-ID: <22969.1217263464@sss.pgh.pa.us>
Permalink:  ../22969.1217263464@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22969.1217263464@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-patches@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stark@enterprisedb.com, ishii@postgresql.org, andrew@tao11.riddles.org.uk, pgsql-hackers@postgresql.org
  Subject: Re: WITH RECUSIVE patches 0723
  In-Reply-To: <22969.1217263464@sss.pgh.pa.us>
  References: <20080725001513.GF16438@fetter.org> <20080725.092652.105178884.t-ishii@sraoss.co.jp> <87r69gs967.fsf@news-spur.riddles.org.uk> <20080728.162925.23020498.t-ishii@sraoss.co.jp> <19882.1217256991@sss.pgh.pa.us> <878wvmt1d2.fsf@oxford.xeocode.com> <22969.1217263464@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox