Here's the final patch.
The commit msg says backpatched to 9.1, but given lack of backpatch of
another bugfix (commit 59367fdf9 for bug #9923) it doesn't actually
apply. I'd rather backpatch that fix and then apply this one.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services