Hi,
I've pushed this after some minor cleanup and improvements.
regards
-- Tomas Vondra http://www.2ndQuadrant.comPostgreSQL Development, 24x7 Support, Remote DBA, Training & Services