Hi Peter,
Idea is really very good.
About the patch:
Patch looks good to me.
Applied cleanly on latest sources. make / make install / make check / initdb everything works well.
Tested with few options and it is working well.
However, I think you need to add this in docs. Letting people know about this environment variable to make use of that.
Thanks