Hi
I did not review patch, just want add link to related bug 15580 and one another -hackers thread:
https://www.postgresql.org/message-id/flat/15580-d1a6de5a3d65da51%40postgresql.orghttps://www.postgresql.org/message-id/flat/CAOVr7%2B3C9u_ZApjxpccrorvt0aw%3Dk8Ct5FhHRVZA-YO36V3%3Drg%40mail.gmail.com
regards, Sergei