Re: [GENERAL] Is it possible to change a columns name

From: Kevin Heflin <kheflin(at)shreve(dot)net>
To: Pavel PaJaSoft Janousek <janousek(at)fonet(dot)cz>
Cc: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>, Wim Ceulemans <wim(dot)ceulemans(at)nice(dot)be>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Is it possible to change a columns name
Date: 1999-03-10 23:06:45
Message-ID: Pine.LNX.4.04.9903101705280.4494-100000@mercury.shreve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 10 Mar 1999, Pavel PaJaSoft Janousek wrote:

> > alter table classname1 [*]
> > rename [column] attname1 to attname2
>
>
> It's good idea, but if I would change not the name, but properties for example :
> create table pokus (col1 int, col2 varchar (20));
>
> and now I would col1 as col1 int default 5 and col2 varchar (20) not null.
> or col2 varchar (30)...
>
> I search many MB of text about SQL etc., but I found only command for
> adding column or for the renaming it, but what about remove some
> column or change properties of column?

I've run into this problem many times.. best answer I've found has been to
dump the database, recreate the table making any necessary changes, than
copy the data back in.

--------------------------------------------------------------------
Kevin Heflin | ShreveNet, Inc. | Ph:318.222.2638 x103
VP/Mac Tech | 333 Texas St #619 | FAX:318.221.6612
kheflin(at)shreve(dot)net | Shreveport, LA 71101 | http://www.shreve.net
--------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Heflin 1999-03-10 23:20:19 Re: [GENERAL] pg_dump bug with default date
Previous Message Thomas Reinke 1999-03-10 23:02:20 Re: [GENERAL] More information