From: Richard Broersma <richard.broersma@gmail.com>
To: sql pgsql <pgsql-sql@postgresql.org>
Subject: Learning about WITH RECURSIVE
Date: Wed, 4 Nov 2009 14:03:33 -0800
Message-ID: <396486430911041403u639c750bn488ada60822448c0@mail.gmail.com> (raw)
Can anyone one explain why a "WITH RECURSIVE" query has the same
results regardless whether UNION or UNION ALL is specified?
broersr=> WITH RECURSIVE t(n) AS (
broersr(> VALUES (1)
broersr(> UNION
broersr(> SELECT n+1 FROM t WHERE n < 100
broersr(> )
broersr-> SELECT sum(n) FROM t;
sum
------
5050
(1 row)
broersr=> WITH RECURSIVE t(n) AS (
broersr(> VALUES (1)
broersr(> UNION ALL
broersr(> SELECT n+1 FROM t WHERE n < 100
broersr(> )
broersr-> SELECT sum(n) FROM t;
sum
------
5050
(1 row)
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: richard.broersma@gmail.com
Subject: Re: Learning about WITH RECURSIVE
In-Reply-To: <396486430911041403u639c750bn488ada60822448c0@mail.gmail.com>
* 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