Copying a row within table

Поиск
Список
Период
Сортировка
От Aarni Ruuhimäki
Тема Copying a row within table
Дата
Msg-id 200603140919.49246.aarni@kymi.com
обсуждение исходный текст
Ответы Re: Copying a row within table  (george young <gry@ll.mit.edu>)
Re: Copying a row within table  (John DeSoi <desoi@pgedit.com>)
Список pgsql-sql
Hi people,

testing=# INSERT INTO foo (SELECT * FROM foo WHERE foo_id = 2);
ERROR:  duplicate key violates unique constraint "foo_pkey"
testing=#

testing=# INSERT INTO foo (foo_1, foo_2, foo_3 ...) (SELECT foo_1, foo_2,
foo_3 ... FROM message_table WHERE foo_id = 10);
INSERT 717286 1
testing=#

Is there a fast way to copy all but not the PK column to a new row within the
same table so that the new foo_id gets its value from the sequence ?

TIA and BR,

Aarni

--
Aarni Ruuhimäki
--------------
This is a bugfree broadcast to you
from **Kmail**
on **Fedora Core** linux system
--------------


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

Предыдущее
От: "Eugene E."
Дата:
Сообщение: Re: Permission to Select -- I am wrong
Следующее
От: Jean-Paul Argudo
Дата:
Сообщение: Re: connectby documentation