Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 14E8964FFEC; Sun, 20 Jul 2008 21:00:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 39257-06; Sun, 20 Jul 2008 21:00:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fetter.org (start.fetter.org [66.92.188.65]) by postgresql.org (Postfix) with ESMTP id 029D164FFC0; Sun, 20 Jul 2008 21:00:09 -0300 (ADT) Received: by fetter.org (Postfix, from userid 500) id 24D9BFBCA10; Sun, 20 Jul 2008 17:00:05 -0700 (PDT) Date: Sun, 20 Jul 2008 17:00:05 -0700 From: David Fetter To: Tatsuo Ishii Cc: tgl@sss.pgh.pa.us, er@xs4all.nl, pgsql-patches@postgresql.org, pgsql-hackers@postgresql.org, y-asaba@sraoss.co.jp Subject: Re: [PATCHES] WITH RECUSIVE patches 0717 Message-ID: <20080721000005.GE26142@fetter.org> References: <12057.156.83.1.19.1216402224.squirrel@webmail.xs4all.nl> <20080721.004216.38709223.t-ishii@sraoss.co.jp> <29621.1216570950@sss.pgh.pa.us> <20080721.081935.116359430.t-ishii@sraoss.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080721.081935.116359430.t-ishii@sraoss.co.jp> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/913 X-Sequence-Number: 121173 On Mon, Jul 21, 2008 at 08:19:35AM +0900, Tatsuo Ishii wrote: > > > Thus I think we should avoid this kind of ORDER BY. Probably we should > > > avoid LIMIT/OFFSET and FOR UPDATE as well. > > > > What of index-optimized SELECT max(...) ? > > Aggregate functions in a recursive term is prohibited by the > standard. For example, > > WITH RECURSIVE x(n) AS (SELECT 1 UNION ALL SELECT max(n) FROM x) > SELECT * FROM x; > > produces an error. On the other side of UNION ALL, it's OK, right? For example, WITH RECURSIVE x(n) AS ( SELECT max(i) FROM t UNION ALL SELECT n+1 FROM x WHERE n < 20 ) Cheers, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate