Here is another approach, that would retain column order. It will
require that the table be locked while this proceeds, but I think this
is a good idea anyway.

lock table
create newtable as select c1, c2, c3::newtype
modify pg_class to point to the new filename
modify existing pg_attribute for the column in question
recreate indexes that exist on the column
unlock table


On Fri, 2003-11-14 at 09:57, Peter Eisentraut wrote:
> Rod Taylor writes:
> > The method is rename old column, add new column, move data across, move
> > or reform dependencies, drop old column.
> I can do this by hand.  If we have an explicit command to do it, then it
> needs to preserve the table schema.  Else, this feature would be mostly
> useless and a certain source of complaints.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to