Re: [PATCH] Allow multiple recursive self-references

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Denis Hirn <denis(dot)hirn(at)uni-tuebingen(dot)de>, Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pantelis Theodosiou <ypercube(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Allow multiple recursive self-references
Date: 2021-08-27 14:17:35
Message-ID: 11726e7f-cb50-fb79-dff6-4c409985538c@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I tested the following query (from SQLite documentation):

CREATE TABLE edge(aa INT, bb INT);

WITH RECURSIVE nodes(x) AS (
SELECT 59
UNION
SELECT aa FROM edge JOIN nodes ON bb=x
UNION
SELECT bb FROM edge JOIN nodes ON aa=x
)
SELECT x FROM nodes;

ERROR: 42P19: recursive reference to query "nodes" must not appear
within its non-recursive term
LINE 4: SELECT aa FROM edge JOIN nodes ON bb=x
^
LOCATION: checkWellFormedRecursionWalker, parse_cte.c:960

This well-formedness check apparently needs to be enhanced to allow for
more than two branches in the union.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-08-27 14:26:58 Re: Avoid repeated PQfnumber() in pg_dump
Previous Message Daniel Gustafsson 2021-08-27 14:00:37 Re: [PATCH] Add OAUTH2_SCOPE variable for scope configuration