On 2014-03-17 19:58:18 -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > Andres Freund wrote:
> >> I think the best way to really cleanup a table is to use something like:
> >> ALTER TABLE rew ALTER COLUMN data TYPE text USING (data);
> >> where text is the previous type of the column. That should trigger a
> >> full table rewrite, without any finesse about tracking ctid chains.
>
> > Isn't this what VACUUM FULL does?
>
> AFAIR, both VACUUM FULL and CLUSTER will attempt to preserve update
> chains, and thus will probably get confused by this bug (though I've
> not looked into exactly what will happen). I'm not real sure that ALTER
> TABLE is any better --- doesn't all that stuff go through rewriteheap.c
> now?
Nope, it's using ATRewriteTable(), which just does a loop around
heap_getnext() and does a plain heap_insert(). Normally that's rather
annoying because it completely destroys visibility information, but in
this case...
Greetings,
Andres Freund
-- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services