Re: How can I change type of column

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: mlists <mlists(at)panforma(dot)co(dot)yu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How can I change type of column
Date: 2004-03-31 16:39:42
Message-ID: 20040331163942.GB577@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 31, 2004 at 17:36:12 +0200,
mlists <mlists(at)panforma(dot)co(dot)yu> wrote:
> Can I change type of column with alter table command?
>
> For instance if I have a table t1 and column c1 which is defined as
> decimal(18, 2) and I want to change it into decimal(18, 3) in MS SQL
> server I can write:
>
> alter table t1 alter column c1 decimal(18, 3)
>
> Is there something similar in PostgreSQL? Tnx in advance.

Not yet.
You can do this in several commands in a single transaction in recent versions
of postgres. You can do an add, update, drop and rename to affect the same
change.
In this case you might be able to do the change by updating the catalog
tables directly, but I don't know exactly what you would need to do.
Unless your table is huge it probably isn't worth doing it that way.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2004-03-31 16:44:48 Re: select statement sorting
Previous Message Bruno Wolff III 2004-03-31 16:35:58 Re: select statement sorting