pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: nish2575@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6498: with recursive / union all
Date: Wed, 29 Feb 2012 15:48:48 -0500
Message-ID: <7426.1330548528@sss.pgh.pa.us> (raw)
In-Reply-To: <E1S2nzs-0007NC-Jd@wrigleys.postgresql.org>
References: <E1S2nzs-0007NC-Jd@wrigleys.postgresql.org>

nish2575@gmail.com writes:
> this doesn't loop infinitely:

>  insert into acyc values ('a','b') ,('b','c');

>  with recursive paths as (
> select frm, too, 1 as lvl from acyc
> union all
> select fnd.frm, a.too, lvl + 1 from acyc a join paths fnd on fnd.too =
> a.frm ) select * from paths;

Why would it?  You don't have any loops in the data.  In particular that
means there will be no join matches after a certain number of levels.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <7426.1330548528@sss.pgh.pa.us>
Permalink:  ../7426.1330548528@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7426.1330548528@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, nish2575@gmail.com
  Subject: Re: BUG #6498: with recursive / union all
  In-Reply-To: <7426.1330548528@sss.pgh.pa.us>
  References: <E1S2nzs-0007NC-Jd@wrigleys.postgresql.org> <7426.1330548528@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