Re: how to select one column into another in same table?

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: how to select one column into another in same table?
Дата
Msg-id CAOR=d=14GyurSZ0e-j5O7ordmrvNT1F=qN853VR0vdasz2d8WQ@mail.gmail.com
обсуждение исходный текст
Ответ на how to select one column into another in same table?  ("J.V." <jvsrvcs@gmail.com>)
Ответы Re: how to select one column into another in same table?
Список pgsql-general
On Tue, Oct 4, 2011 at 12:24 PM, J.V. <jvsrvcs@gmail.com> wrote:
> 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.

Do you need another column or do you just want to alter a column that
already exists?  If so you can alter a column from one type to another
and throw a using clause at it to convert the data in some way.  I
think we need to know a bit better what you're trying to do.,

В списке pgsql-general по дате отправления:

Предыдущее
От: "J.V."
Дата:
Сообщение: how to select one column into another in same table?
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: fail: alter table NOCHECK CONSTRAINT ALL;