Re: ALTER TABLE modifications - Mailing list pgsql-patches

From Dave Cramer
Subject Re: ALTER TABLE modifications
Date
Msg-id 1068825571.1625.197.camel@localhost.localdomain
Whole thread Raw
In response to Re: ALTER TABLE modifications  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: ALTER TABLE modifications
List pgsql-patches
OK,

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

Dave

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.


pgsql-patches by date:

Previous
From: Rod Taylor
Date:
Subject: Re: ALTER TABLE modifications
Next
From: Tom Lane
Date:
Subject: Re: ALTER TABLE modifications