alter table modify column?

Поиск
Список
Период
Сортировка
От Kevin Brannen
Тема alter table modify column?
Дата
Msg-id 3D2CC064.7010108@nurseamerica.net
обсуждение исходный текст
Ответы Re: alter table modify column?
Список 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 по дате отправления:

Предыдущее
От: acchung@mit.edu
Дата:
Сообщение: postgres authentication
Следующее
От: David Stanaway
Дата:
Сообщение: Re: alter table modify column?