Re: add column specify position

Поиск
Список
Период
Сортировка
От Johan Nel
Тема Re: add column specify position
Дата
Msg-id hkb1pd$b5e$1@news.eternal-september.org
обсуждение исходный текст
Ответ на add column specify position  (Scott Frankel <frankel@circlesfx.com>)
Список pgsql-general
Hi Scott
Scott Frankel wrote:
>
> Hi all,
>
> Is it possible to specify a position when adding a column to a table?
No not AFAIK.

> I want to swap one column for another without losing the column's
> position.  eg:  given that 'foo' is the 5th column in an 8 column table,
> I want to replace it with a 'bar' column at column 5.
>
>     ALTER TABLE qwe DROP COLUMN foo;
>     ALTER TABLE qwe ADD COLUMN bar;

ALTER TABLE qwe RENAME COLUMN foo TO bar;

That does imply the COLUMN TYPE stays the same though...  The help file
does have examples in the ALTER TABLE section how to change the TYPE of a
column.

HTH,

Johan Nel
Pretoria, South Africa.

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Frankel
Дата:
Сообщение: add column specify position
Следующее
От: dipti shah
Дата:
Сообщение: Re: Questions on PostGreSQL Authentication mechanism...