So sadly since this got reverted for Pg 19, I've incorporated some
feedback and refactored a bit.
Enclosed is a version targeting `master`, rebased to today and
validating the cases that have been pointed out.
I will add this to the commitfest app for PG 20.
Best,
David