Re: ALTER TABLE TODO items

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER TABLE TODO items
Date: 2004-05-05 17:51:23
Message-ID: 200405051751.i45HpNu11161@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> select * from another;
> f1 | f2
> ----+-------
> 1 | one
> 2 | two
> 3 | three
> (3 rows)
>
> alter table another
> alter f1 type text using f2 || ' more',
> alter f2 type bigint using f1 * 10;
>
> select * from another;
> f1 | f2
> ------------+----
> one more | 10
> two more | 20
> three more | 30
> (3 rows)

Wow, you can reference different column as part of the alter column.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2004-05-05 17:59:04 Re: ALTER TABLE TODO items
Previous Message Tom Lane 2004-05-05 17:47:21 Re: ALTER TABLE TODO items

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-05-05 17:59:04 Re: ALTER TABLE TODO items
Previous Message F Harvell 2004-05-05 17:49:11 Re: Postgres Crashes