Re: BUG #6498: with recursive / union all

From: "k/a" <nish2575(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6498: with recursive / union all
Date: 2012-02-29 22:25:30
Message-ID: CAK5PFiUvDG9dAOqPv7FysPy9czwA+mSEfrOmxT5k6S_0qooXOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

but {5} union {5} = {5, 5}
so ('a', 'c', 2) union all ('a','c', 2) = {('a', 'c', 2), ('a', 'c', 2)}

the second ('a', 'c', 2) should result from joining the latest working
table in paths which includes {('a', 'b', 1), ('b', 'c', 1), ('a',
'c', 2)} with {('a','b'), ('b', 'c')} specifically ('a', 'b', 1) with
('a', 'b')

maybe i'm stupid or not understanding some assumption, but i interpret
not removing duplicates within and between tables as stated in the
docs for the union all case, as not removing the a,c,2 above.

-kanishka

On 2/29/12, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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

Browse pgsql-bugs by date

  From Date Subject
Next Message Tatsuo Ishii 2012-02-29 23:10:02 Re: BUG #6497: Error sent to client, but data written anyway
Previous Message Tom Lane 2012-02-29 21:27:57 Re: BUG #6497: Error sent to client, but data written anyway