I noticed that there is no CF entry for this, so created one in the next CF:
https://commitfest.postgresql.org/34/3270/
Rebased patch attached.