I said:
> Other than that, it seems like it'd work, and it'd allow us to do a
> normal transaction commit internally in VACUUM, which is a lot cleaner
> than what VACUUM does now.
I punted on actually changing repair_frag's RecordTransactionCommit()
call into CommitTransactionCommand()/StartTransactionCommand(). That
would now work as far as holding an exclusive lock on the table goes,
but there's more code that would have to be added to close/reopen the
relation and its indexes, ensure that all of VACUUM's internal data
structures survive into the new transaction, etc etc. I didn't have time
for that right now, so I left it as-is. Perhaps someone will feel like
cleaning it up for 7.2 or later.
However, the important thing is fixed: a TOAST table is now vacuumed
in a separate transaction from its master, while still holding a lock
that prevents anyone else from touching the master.
regards, tom lane