I just pushed this. I hope not to have upset you too much with the subroutine thing.
Thanks for the submission and Kirk for the review. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services