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


Reply via email to