While looking these patches over I noticed that we still have some error reports cases uncovered. Here's a quick attempt to try and complete that.
After this patch I see only one uncovered error path, the one that prevents repacking a temp table of another session. That would require an isolation test. Not sure it's worth the trouble ... (There's a bunch of uncovered "elog(ERROR)" cases, but those are mostly just can't-happen conditions, as I understand).
LGTM, thanks for adding these.
FWIW I see a couple more uncovered ereport(ERROR) paths 1/ invalid index (line 813) 2/ shared catalog with USING INDEX (line 580, needs allow_system_table_mods). But both need unusual setup, so