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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #18536: Using WITH inside WITH RECURSIVE triggers a "shouldn't happen" error
Date: 2024-07-13 09:00:00
Message-ID: 18536-0a342ec07901203e@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18536
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 17beta2
Operating system: Ubuntu 22.04
Description:

The following query:
WITH RECURSIVE t(n) AS (
WITH t1 AS (SELECT 1 FROM t) SELECT 1
UNION
SELECT 1 FROM t1)
SELECT * FROM t;

triggers an error:
ERROR: XX000: missing recursive reference
LOCATION: checkWellFormedRecursion, parse_cte.c:896

which is seemingly not expected:
if (cstate->selfrefcount != 1) /* shouldn't happen */
elog(ERROR, "missing recursive reference");

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-07-14 15:09:37 Re: BUG #18536: Using WITH inside WITH RECURSIVE triggers a "shouldn't happen" error
Previous Message jian he 2024-07-12 16:35:19 Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);