Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
> I wonder if we could clean up those lost files on database recovery or
> vacuum.
There is a TODO for this, but it seems exceedingly low priority to me.
In any case I'd not recommend troubling to work on the problem until
the tablespaces merry-go-round comes to a complete stop, since that
restructuring will likely change what you'd need to do to identify
unreferenced files.
regards, tom lane