Here is a new patch that addresses the previous review comments.
If there are no new comments, I think this might be ready to go.
-- Peter Eisentraut http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services