Is there a chance to see you restarting working on this patch ?
I noticed that despite interest to the matter, the discussion in this CF thread stopped quite a while ago. So I'd like to push here a patch revised according to the previous discussion. Actually the patch is being used as a part of the pg_query_state extension during several major PostgreSQL releases. So I'd like to raise the matter of reviewing this updated patch and include it into version 14 as I see much use of this change.