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

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to