Re: Modifying column size

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Modifying column size
Date: 2002-07-19 21:43:59
Message-ID: 20020719174359.L6252@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alessandro Baretta 2002-07-19 21:55:51 Re: COMMIT in PostgreSQL
Previous Message scott.marlowe 2002-07-19 21:36:27 Re: Modifying column size