pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adam Mackler <AdamMackler@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Possible Bug in 9.2beta3
Date: Wed, 15 Aug 2012 12:53:44 -0400
Message-ID: <8039.1345049624@sss.pgh.pa.us> (raw)
In-Reply-To: <20120813181700.GA45401@bk.macklerlaw.com>
References: <20120813181700.GA45401@bk.macklerlaw.com>

Adam Mackler <AdamMackler@gmail.com> writes:
> WITH RECURSIVE
> tab(id_key,link) AS ( VALUES (1,17), (2,17), (3,17), (4,17), (6,17), (5,17) ),
> iter (id_key, row_type, link) AS (
>     SELECT 0, 'base', 17
>   UNION(
>     WITH remaining(id_key, row_type, link, min) AS (
>       SELECT tab.id_key, 'true'::text, iter.link, MIN(tab.id_key) OVER ()
>       FROM tab INNER JOIN iter USING (link)
>       WHERE tab.id_key > iter.id_key
>     ),
>     first_remaining AS (
>       SELECT id_key, row_type, link
>       FROM remaining
>       WHERE id_key=min
>     ),
>     effect AS (
>       SELECT tab.id_key, 'new'::text, tab.link
>       FROM first_remaining e INNER JOIN tab ON e.id_key=tab.id_key
>       /* Try changing this WHERE clause to other false expressions */
>       WHERE e.row_type='false'
>     )
>     SELECT * FROM first_remaining
>     /* Try uncommenting the next line */
>     --UNION SELECT * FROM effect
>   )
> )
> SELECT DISTINCT * FROM iter

Right offhand I'm inclined to think that the reference to "iter"
inside the first sub-WITH ought to be disallowed.  I don't recall
the exact rules about where a recursive reference can appear, but
it sure doesn't seem like that ought to be OK, does it?

			regards, tom lane




view thread (5+ messages)  latest in thread

Message-ID: <8039.1345049624@sss.pgh.pa.us>
Permalink:  ../8039.1345049624@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8039.1345049624@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, AdamMackler@gmail.com
  Subject: Re: Possible Bug in 9.2beta3
  In-Reply-To: <8039.1345049624@sss.pgh.pa.us>
  References: <20120813181700.GA45401@bk.macklerlaw.com> <8039.1345049624@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox