Re: RECURSIVE allowed only ONCE in a CTE - Mailing list pgsql-general

From Andrew Gierth
Subject Re: RECURSIVE allowed only ONCE in a CTE
Date
Msg-id 87pnrkgmxe.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to RECURSIVE allowed only ONCE in a CTE  (Jitendra Loyal <jitendra.loyal@gmail.com>)
Responses Re: RECURSIVE allowed only ONCE in a CTE  (Jitendra Loyal <jitendra.loyal@gmail.com>)
List pgsql-general
>>>>> "Jitendra" == Jitendra Loyal <jitendra.loyal@gmail.com> writes:

 Jitendra> I find that the RECURSIVE can be used only once in a CTE.

RECURSIVE can be specified only once, but it applies to all CTEs at that
level. That is to say, RECURSIVE qualifies the preceding WITH, _not_ the
following CTE.

Note that just specifying RECURSIVE doesn't mean that any CTE is
recursive, it simply changes the name scoping rules such that CTEs _can_
be recursive. (Without it, a CTE's name is not in scope in its own body
so recursion is impossible.)

-- 
Andrew (irc:RhodiumToad)


pgsql-general by date:

Previous
From: Jitendra Loyal
Date:
Subject: RECURSIVE allowed only ONCE in a CTE
Next
From: Jitendra Loyal
Date:
Subject: Re: RECURSIVE allowed only ONCE in a CTE