Re: [PATCHES] WITH RECUSIVE patches 0717

From: David Fetter <david(at)fetter(dot)org>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, er(at)xs4all(dot)nl, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, y-asaba(at)sraoss(dot)co(dot)jp
Subject: Re: [PATCHES] WITH RECUSIVE patches 0717
Date: 2008-07-21 00:00:05
Message-ID: 20080721000005.GE26142@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2008-07-21 01:13:58 Re: [PATCHES] WITH RECUSIVE patches 0717
Previous Message Tatsuo Ishii 2008-07-20 23:19:35 Re: [PATCHES] WITH RECUSIVE patches 0717

Browse pgsql-patches by date

  From Date Subject
Next Message Tatsuo Ishii 2008-07-21 01:13:58 Re: [PATCHES] WITH RECUSIVE patches 0717
Previous Message Tatsuo Ishii 2008-07-20 23:19:35 Re: [PATCHES] WITH RECUSIVE patches 0717