alter table modify column? - Mailing list pgsql-admin

From Kevin Brannen
Subject alter table modify column?
Date
Msg-id 3D2CC064.7010108@nurseamerica.net
Whole thread Raw
Responses Re: alter table modify column?  (David Stanaway <david@stanaway.net>)
List pgsql-admin
As we transition our database, I'm finding the need to change columns
types.  I'm also finding this to be a major PITA.

I have a column that's a something like:

create table stuff
(
...
rate   varchar(7),
...
);

However that doesn't allow math-like functions (e.g. avg), so it's gotta
be changed.  I'd like to do something on the order of:

alter table stuff modify rate DECIMAL(5,2);

but that doesn't work.  I've scoured the docs and can't seem to find
anything other than:

1. create new table with changed columns,
2. copy data over,
3. remove old table,
4. rename new table to old table

Please tell me there's an easier way!  And of course how. :-)

Also, I can't find a "alter table drop column NAME" to remove a column
either.

TIA,
Kevin


pgsql-admin by date:

Previous
From: acchung@mit.edu
Date:
Subject: postgres authentication
Next
From: David Stanaway
Date:
Subject: Re: alter table modify column?