I wrote:
> Hmm ... this doesn't look very much like what I was imagining. Let
> me draft a prototype and we can compare.
Here's what I was thinking about. I didn't bother adding regression
test cases yet, but it fixes both of the symptoms Alexander found.
This looks pretty workable to me, and in particular I think it'd be
safe to backpatch (with some fields moved to the end of their structs
to satisfy ABI worries). We could then revert 3f7323cbb et al
in the back branches.
regards, tom lane