Re: Modifying column size

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: Modifying column size
Дата
Msg-id 20020719174359.L6252@mail.libertyrms.com
обсуждение исходный текст
Ответ на Modifying column size  ("Susan Lane" <suel@dpn.com>)
Список pgsql-general
On Fri, Jul 19, 2002 at 02:14:10PM -0700, Susan Lane wrote:
> I was wondering if anyone here knew of a way to modify the size of a column
> in Postgres.  In Oracle, you can use the following syntax:
>
>     alter table usrs modify passwd varchar2(32);    (For Postgres, I changed
> the datatype to varchar)
>
> But, when I try this in psql, it doesn't like the modify keyword.  I looked
> in the documentation, and I found a doc note that someone else had tried
> this as well to no avail.  Anybody know what is the correct syntax or if
> this can even be done in Postgres?

No can do.  You could work around this if you had no triggers,
foreign keys, &c. on those columns, by adding a new column of the
desired size and type, then updating it with the required data, then
renaming the old column, then renaming the new column to the desired
name.  (No, you can't drop the old column, either, but you could set
it to all null to save space.)

A

--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110


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

Предыдущее
От: Tom Jenkins
Дата:
Сообщение: Re: COMMIT in PostgreSQL
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: COMMIT in PostgreSQL