Andres Freund <andres@2ndquadrant.com> writes:
> On 2014-03-17 19:55:01 -0400, Tom Lane 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);
>> Um... don't we have logic in there that's smart enough to short-circuit
>> that?
> Not with USING present I think?
regression=# create table foo as select generate_series(1,1000000) as data;
SELECT 1000000
Time: 575.113 ms
regression=# alter table foo alter column data type int4 using (data);
ALTER TABLE
Time: 1001.859 ms
regression=# alter table foo alter column data type int4 using (data);
ALTER TABLE
Time: 0.821 ms
regression=# alter table foo alter column data type int8 using (data);
ALTER TABLE
Time: 677.810 ms
regression=# alter table foo alter column data type int8 using (data);
ALTER TABLE
Time: 1.085 ms
Looks like it's smart enough to me.
regards, tom lane