Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id C59D7AD3D75 for ; Wed, 29 Feb 2012 14:11:43 -0400 (AST) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S2o05-0004O9-N8 for pgsql-bugs@postgresql.org; Wed, 29 Feb 2012 18:11:42 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S2nzs-0000Da-U8 for pgsql-bugs@postgresql.org; Wed, 29 Feb 2012 18:11:28 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1S2nzs-0007NC-Jd for pgsql-bugs@postgresql.org; Wed, 29 Feb 2012 18:11:28 +0000 Date: Wed, 29 Feb 2012 18:11:28 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6498: with recursive / union all To: pgsql-bugs@postgresql.org From: nish2575@gmail.com X-Pg-Spam-Score: -1.0 (-) X-Archive-Number: 201202/211 X-Sequence-Number: 32554 The following bug has been logged on the website: Bug reference: 6498 Logged by: kanishka Email address: nish2575@gmail.com PostgreSQL version: 9.0.6 Operating system: Linux 2.6.41.4-1.fc15.i686 / fedora 15 Description: = here is an example of what i believe the system is not obeying the expectation of a union all instead of a union, in a recursive with query that uses a join. the documentation page on with queries also has an example with union all over an acyclic graph data set that i believe should loop infinitely according the descriptoin of with query processing. 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 =3D a.frm ) select * from paths; while this does loop infinitely: with recursive p as (select 5 union all select * from p ) select * from p; my guess is the performing of the join is causing duplicates inadvertantly.