Added the patch to the open commitfest:https://commitfest.postgresql.org/42/4116/
Feel free to reject if it's not interesting.
-- Pavel Luzanov