X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B3168D1B449 for ; Tue, 13 Jan 2004 16:29:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 78604-01 for ; Tue, 13 Jan 2004 12:29:06 -0400 (AST) Received: from mail1.dr.myx.net (mail1.dr.myx.net [217.10.193.161]) by svr1.postgresql.org (Postfix) with ESMTP id 5098CD1DD24 for ; Tue, 13 Jan 2004 12:29:00 -0400 (AST) Received: from appserver (unknown [82.137.2.202]) by mail1.dr.myx.net (mydomain.myx.net) with ESMTP id BB010300A06; Tue, 13 Jan 2004 18:28:56 +0200 (EET) Message-ID: <061a01c3d9f2$9a253ab0$6500a8c0@wylog.local> From: "Viorel Dragomir" To: , "Postgres-SQL" References: <1074011028.18994.18.camel@weaver.tuc.noao.edu> Subject: Re: Copying rows between tables? Date: Tue, 13 Jan 2004 18:30:47 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/111 X-Sequence-Number: 16504 ----- Original Message ----- From: "Steve Wampler" To: "Postgres-SQL" Sent: Tuesday, January 13, 2004 18:23 Subject: [SQL] Copying rows between tables? > > I know I can select from one table into a new table, but is > there a way to select from one table into an existing table > (aside from copying everything to a file, editing the file > and then copying from that file)? Without destroying existing > entries, of course... INSERT INTO table1(row1, row2) SELECT row1, row2 FROM archive_table; > > I have an application where old records are archived into > 'archive' tables. Occasionally there is a need to copy > some of these old records into the 'active' table. > > Thanks for any pointers! > Steve > -- > Steve Wampler -- swampler@noao.edu > The gods that smiled on your birth are now laughing out loud. > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match