Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> This patch only directly addresses the issue of cleaning up the
> storage, so there are still the catalog entries to worry about. But
> it doesn't seem impossible to think about building on this approach to
> eventually handle that part of the problem better, too. I haven't
> thought too much about what that would look like, but I think it could
> be done.
Perhaps run through pg_class after restart and flush anything marked
relistemp? Although the ideal solution, probably, would be for temp
tables to not have persistent catalog entries in the first place.
regards, tom lane