Actually, the original coding is better because it enables easier
writing of other optimizations, such as in the attached which should
also cure the performance regression noted in bug #8470.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services