Re: Modifying column size - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Modifying column size
Date
Msg-id 20020719174359.L6252@mail.libertyrms.com
Whole thread Raw
In response to Modifying column size  ("Susan Lane" <suel@dpn.com>)
List 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 by date:

Previous
From: Tom Jenkins
Date:
Subject: Re: COMMIT in PostgreSQL
Next
From: "scott.marlowe"
Date:
Subject: Re: COMMIT in PostgreSQL