Re: [PATCH] Allow multiple recursive self-references - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCH] Allow multiple recursive self-references
Date
Msg-id 11726e7f-cb50-fb79-dff6-4c409985538c@enterprisedb.com
Whole thread Raw
In response to Re: [PATCH] Allow multiple recursive self-references  (Denis Hirn <denis.hirn@uni-tuebingen.de>)
Responses Re: [PATCH] Allow multiple recursive self-references  (Denis Hirn <denis.hirn@uni-tuebingen.de>)
List 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.



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: [PATCH] Add OAUTH2_SCOPE variable for scope configuration
Next
From: Daniel Gustafsson
Date:
Subject: Re: Avoid repeated PQfnumber() in pg_dump