pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Fetter <david@fetter.org>
To: Tatsuo Ishii <ishii@postgresql.org>
Cc: tgl@sss.pgh.pa.us
Cc: er@xs4all.nl
Cc: pgsql-patches@postgresql.org
Cc: pgsql-hackers@postgresql.org
Cc: y-asaba@sraoss.co.jp
Subject: Re: [PATCHES] WITH RECUSIVE patches 0717
Date: Sun, 20 Jul 2008 17:00:05 -0700
Message-ID: <20080721000005.GE26142@fetter.org> (raw)
In-Reply-To: <20080721.081935.116359430.t-ishii@sraoss.co.jp>
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>

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 <david@fetter.org> 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



view thread (11+ messages)  latest in thread

Message-ID: <20080721000005.GE26142@fetter.org>
Permalink:  ../20080721000005.GE26142@fetter.org/
Also on:    postgresql.org/message-id/20080721000005.GE26142@fetter.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-patches@postgresql.org
  Cc: david@fetter.org, ishii@postgresql.org, tgl@sss.pgh.pa.us, er@xs4all.nl, pgsql-hackers@postgresql.org, y-asaba@sraoss.co.jp
  Subject: Re: [PATCHES] WITH RECUSIVE patches 0717
  In-Reply-To: <20080721000005.GE26142@fetter.org>

* 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