Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 40F109FB225 for ; Thu, 26 Oct 2006 18:40:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 34620-10 for ; Thu, 26 Oct 2006 21:40:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 7A7B19FB25A for ; Thu, 26 Oct 2006 18:40:08 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id A734456446; Thu, 26 Oct 2006 16:40:06 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Thu, 26 Oct 2006 16:40:01 -0500 Date: Thu, 26 Oct 2006 16:40:01 -0500 From: "Jim C. Nasby" To: Shane Ambler Cc: Duncan McDonald , pgsql-admin@postgresql.org Subject: Re: Backing Up Partial Databases Message-ID: <20061026214001.GK26892@nasby.net> References: <018701c6f8ac$0ad93bf0$2102a8c0@Firefly> <454057CD.5030401@007Marketing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <454057CD.5030401@007Marketing.com> X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:061026:pgsql@007marketing.com::xgIWAE9MziouTtlc:000000000000000 0000000000000000000000000mfR X-Hashcash: 1:20:061026:duncan@gpats.com.au::VoV5jeCwK2H2kgh0:000000000000000000 0000000000000000000000008Xxh X-Hashcash: 1:20:061026:pgsql-admin@postgresql.org::hoFaP9B5/s0YT+Im:00000000000 000000000000000000000000CvAk X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/191 X-Sequence-Number: 23494 On Thu, Oct 26, 2006 at 04:08:05PM +0930, Shane Ambler wrote: > >I have two identical databases (primary and backup) and I need to > >transfer a small portion of missing data from one to the other. Is there > >an easier way to do this rather than SELECT-ing the interval then > >parsing the ouput to look like INSERT statements? > > > > I can think of a couple of ways - > > COPY (SELECT * FROM myPrimaryTable WHERE id<200) TO '/tmp/myData'; Only in 8.2... > the --inserts option of pg_dump will export as INSERT's if that is the > way you want to do it. You will need to do a find and replace on the > INSERT's to change the table name though. Though, I don't see any reason you'd want to do that; just stick with the pg_dump defaults. Another option is to use dbi_link. -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)