how to select one column into another in same table?

From: "J(dot)V(dot)" <jvsrvcs(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: how to select one column into another in same table?
Date: 2011-10-04 18:24:34
Message-ID: 4E8B4F62.5010308@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Currently I can select one column into another with two statements:

alter table <table_name> add column id_old int;
update <table_name> set id_old = id;

Is there a way to do this in one statement with a select into? I have
tried various select statements but want the new column (with the same
data) to be in the same table and to have it execute much more quickly
that the two statements currently do.

thanks

J.V.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2011-10-04 19:09:21 Re: how to select one column into another in same table?
Previous Message J.V. 2011-10-04 18:21:35 fail: alter table <table_name> NOCHECK CONSTRAINT ALL;