X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 685B19DC812 for ; Tue, 14 Mar 2006 03:19:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61659-06 for ; Tue, 14 Mar 2006 03:19:56 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4F0849DC83F for ; Tue, 14 Mar 2006 03:19:54 -0400 (AST) Received: from smtp10.kymp.net (smtp10.kymp.net [80.248.96.136]) by svr4.postgresql.org (Postfix) with ESMTP id 181375AF184 for ; Tue, 14 Mar 2006 07:19:54 +0000 (GMT) Received: from [192.168.0.100] (static-241-66.kymp.net [213.130.241.66]) by smtp10.kymp.net (8.13.3/8.13.3) with SMTP id k2E7JnLd015943 for ; Tue, 14 Mar 2006 09:19:49 +0200 From: Aarni =?iso-8859-1?q?Ruuhim=E4ki?= Reply-To: aarni@kymi.com Organization: KYMI.com To: pgsql-sql@postgresql.org Subject: Copying a row within table Date: Tue, 14 Mar 2006 09:19:49 +0200 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200603140919.49246.aarni@kymi.com> X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.196 required=5 tests=[AWL=0.196] X-Spam-Score: 0.196 X-Spam-Level: X-Archive-Number: 200603/217 X-Sequence-Number: 24563 Hi people, testing=3D# INSERT INTO foo (SELECT * FROM foo WHERE foo_id =3D 2); ERROR: duplicate key violates unique constraint "foo_pkey" testing=3D# testing=3D# INSERT INTO foo (foo_1, foo_2, foo_3 ...) (SELECT foo_1, foo_2,= =20 foo_3 ... FROM message_table WHERE foo_id =3D 10); INSERT 717286 1 testing=3D# Is there a fast way to copy all but not the PK column to a new row within t= he=20 same table so that the new foo_id gets its value from the sequence ? TIA and BR, Aarni =2D-=20 Aarni Ruuhim=E4ki =2D------------- This is a bugfree broadcast to you from **Kmail** on **Fedora Core** linux system =2D-------------