Re: Is "WITH RECURSIVE" limited to the first position of CTEs by design?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Kirk Wolak <wolakk(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Is "WITH RECURSIVE" limited to the first position of CTEs by design?
Date: 2023-11-13 16:23:57
Message-ID: CAKFQuwZfQyMFThrAg5r4=D2373GaQ-iZChXCOW6dKGrxjBGzvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 13, 2023 at 9:17 AM Kirk Wolak <wolakk(at)gmail(dot)com> wrote:

> These are the most trivial examples. The second one results in a syntax
> error. Which implies that:
> 1) There can only be one recursive CTE at the same level?
> 2) It must be the FIRST CTE?
>

There is only one WITH keyword as well, that doesn't change the fact there
can be multiple attached queries to it.

The documentation explains clearly the implications on adding the keyword
RECURSIVE after the keyword WITH.

https://www.postgresql.org/docs/current/sql-select.html#SQL-WITH

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-11-13 16:45:24 Re: Unique Primary Key Linked to Multiple Accounts
Previous Message Shaik Mohammad Mujeeb 2023-11-13 16:19:33 Re: Issue in compiling postgres on latest macOS 14.1.1