I wrote:
> After tracing through it, the problem is that rebuild_relation() assumes
> toast tables are always in PG_TOAST_NAMESPACE; which has not been true
> since 8.3. CLUSTER has been renaming temp toast tables into the wrong
> namespace right along. Without the assert to call attention to it, who
> knows how long it would've taken to notice :-(
No, on closer inspection the bug was introduced here:
http://archives.postgresql.org/pgsql-committers/2008-10/msg00118.php
so 8.3 was OK. In a non-asserting build the only consequence would have
been that checks for conflicting names were done in the wrong namespace.
Given the improbability of a conflict, we could have gone a very long
time before noticing the problem. But it was still wrong.
regards, tom lane