Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-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

pgsql-hackers by date

Next:From: Tom LaneDate: 2004-05-05 17:59:04
Subject: Re: ALTER TABLE TODO items
Previous:From: F HarvellDate: 2004-05-05 17:49:11
Subject: Re: Postgres Crashes

pgsql-committers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group