alter table modify column?

From: Kevin Brannen <kevinb(at)nurseamerica(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Subject: alter table modify column?
Date: 2002-07-10 23:16:52
Message-ID: 3D2CC064.7010108@nurseamerica.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David Stanaway 2002-07-10 23:39:48 Re: alter table modify column?
Previous Message Edgar Castanedo 2002-07-10 21:58:11 redhat 7.3 problem