When a relation is moved to another tablespace, we can't assume that we can
commit75a7c04518bb5c2de945bfcbb2113b7c0aa05d17
authorheikki <heikki>
Tue, 7 Oct 2008 11:15:41 +0000 (7 11:15 +0000)
committerheikki <heikki>
Tue, 7 Oct 2008 11:15:41 +0000 (7 11:15 +0000)
tree891ce7d42261091df954852826cf8256659a9d60
parentbda4b1f0a127fc89189e0ce789b39636679bc4c4
When a relation is moved to another tablespace, we can't assume that we can
use the old relfilenode in the new tablespace. There might be another relation
in the new tablespace with the same relfilenode, so we must generate a fresh
relfilenode in the new tablespace.

The 8.3 patch to let deleted relation files linger as zero-length files until
the next checkpoint made this more obvious: moving a relation from one table
space another, and then back again, caused a collision with the lingering
file.

Back-patch to 8.1. The issue is present in 8.0 as well, but it doesn't seem
worth fixing there, because we didn't have protection from OID collisions
after OID wraparound before 8.1.

Report by Guillaume Lelarge.
src/backend/commands/tablecmds.c