On 20 August 2011 15:34, Bruce Momjian <bruce@momjian.us> wrote:
> Actually, using UNION instead of UNION ALL does prevent some infinite
> loops:
While that is worth pointing out, it cannot be recommended as a way of
preventing infinite recursion; after all, all 5 WITH RECURSIVE
examples in the docs use UNION ALL. It's just a different way of
specifying a terminating condition that isn't likely to be applicable
to more complicated rCTEs.
--
Peter Geoghegan http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services