Skip site navigation (1) Skip section navigation (2)

Re: BUG #6498: with recursive / union all

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: nish2575(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6498: with recursive / union all
Date: 2012-02-29 20:48:48
Message-ID: 7426.1330548528@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
nish2575(at)gmail(dot)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

In response to

Responses

pgsql-bugs by date

Next:From: Christophe PettusDate: 2012-02-29 21:05:20
Subject: Re: BUG #6497: Error sent to client, but data written anyway
Previous:From: Tom LaneDate: 2012-02-29 18:56:04
Subject: Re: BUG #6497: Error sent to client, but data written anyway

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group