Re: BUG #18536: Using WITH inside WITH RECURSIVE triggers a "shouldn't happen" error
Aleksander Alekseev <aleksander@timescale.com>
From: Aleksander Alekseev <aleksander@timescale.com>
To: pgsql-bugs@lists.postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>, exclusion@gmail.com
Date: 2024-07-15T12:17:53Z
Lists: pgsql-bugs
Hi, > > triggers an error: > > ERROR: XX000: missing recursive reference > > LOCATION: checkWellFormedRecursion, parse_cte.c:896 > > FWIW I couldn't reproduce the reported error on REL_17_STABLE > (b8bf76cbde39). The error I got seems reasonable: > > ``` > 46087 (master) =# WITH RECURSIVE t(n) AS ( > WITH t1 AS (SELECT 1 FROM t) SELECT 1 > UNION > SELECT 1 FROM t1) > SELECT * FROM t; > ERROR: recursive reference to query "t" must not appear within a subquery > LINE 2: WITH t1 AS (SELECT 1 FROM t) SELECT 1 > ^ > ``` > > We should add regression tests though, as v2 does. Oops. That's because Tom pushed this already (cf588e10f664). Sorry for the noise. -- Best regards, Aleksander Alekseev
Commits
-
Avoid unhelpful internal error for incorrect recursive-WITH queries.
- f96c2c72788c 18.0 landed
- e7f9f44e3bd9 15.8 landed
- cf588e10f664 17.0 landed
- b020a866a22b 13.16 landed
- 8fc4876147fb 16.4 landed
- 236b225ed452 12.20 landed
- 02b4f5e1f26b 14.13 landed