Re: BUG #18536: Using WITH inside WITH RECURSIVE triggers a "shouldn't happen" error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18536: Using WITH inside WITH RECURSIVE triggers a "shouldn't happen" error
Date: 2024-07-14 17:01:32
Message-ID: 2866155.1720976492@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> I think the case you show should be throwing
> ERROR: recursive query "t" does not have the form non-recursive-term UNION [ALL] recursive-term

Hmm, that is probably too strong: it will break some queries we've
historically accepted. What we need is just to forbid self-references
within the WITH clause. The code actually does that already, it's
just doing it too late; so we can fix this with a simple re-ordering
of the error checks, as attached.

regards, tom lane

Attachment Content-Type Size
fix-bug-18536.patch text/x-diff 4.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-07-14 17:30:55 Re: BUG #18536: Using WITH inside WITH RECURSIVE triggers a "shouldn't happen" error
Previous Message Vasilii Smirnov 2024-07-14 15:39:22 libpq: unexpected return code from PQexecParams with a DO INSTEAD rule present