Re: Proposing WITH ITERATIVE

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposing WITH ITERATIVE
Date: 2020-04-29 11:22:43
Message-ID: cf26b533-3d82-11d6-179d-dbcb3a698e3d@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-04-29 07:09, Fabien COELHO wrote:
> I'm wondering about how to use such a feature in the context of WITH query
> with several queries having different behaviors. Currently "WITH"
> introduces a named-query (like a view), "WITH RECURSIVE" introduces a mix
> of recursive and named queries, pg really sees whether each one is
> recursive or not, and "RECURSIVE" is required but could just be guessed.

Yeah the RECURSIVE vs ITERATIVE is a bit of a red herring here. As you
say, the RECURSIVE keyword doesn't specify the processing but marks the
fact that the specification of the query is recursive.

I think a syntax that would fit better within the existing framework
would be something like

WITH RECURSIVE t AS (
SELECT base case
REPLACE ALL -- instead of UNION ALL
SELECT recursive case
)

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tushar 2020-04-29 11:46:40 Re: [Proposal] Global temporary tables
Previous Message Hamid Akhtar 2020-04-29 09:51:09 Re: improving basebackup.c's file-reading code