Re: Proposing WITH ITERATIVE - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Proposing WITH ITERATIVE
Date
Msg-id cf26b533-3d82-11d6-179d-dbcb3a698e3d@2ndquadrant.com
Whole thread Raw
In response to Re: Proposing WITH ITERATIVE  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: Proposing WITH ITERATIVE  ("Jonah H. Harris" <jonah.harris@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Hamid Akhtar
Date:
Subject: Re: improving basebackup.c's file-reading code
Next
From: tushar
Date:
Subject: Re: [Proposal] Global temporary tables