Learning about WITH RECURSIVE - Mailing list pgsql-sql

From Richard Broersma
Subject Learning about WITH RECURSIVE
Date
Msg-id 396486430911041403u639c750bn488ada60822448c0@mail.gmail.com
Whole thread Raw
Responses Re: Learning about WITH RECURSIVE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Bryce Nesbitt
Date:
Subject: Mangled high bit characters with pg_server_prepare=0 in DBD::Pg
Next
From: Tom Lane
Date:
Subject: Re: Learning about WITH RECURSIVE