Skip site navigation (1) Skip section navigation (2)

Re: Converting Copy to insert statement in backup file

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Chris Preston" <chris(at)thetrafalgartravel(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Converting Copy to insert statement in backup file
Date: 2008-07-10 15:44:19
Message-ID: dcc563d10807100844l5664c44fr76c235b70a5c1831@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
On Thu, Jul 10, 2008 at 9:40 AM, Chris Preston
<chris(at)thetrafalgartravel(dot)com> wrote:
> Hello,
>
> I have a backup cron job (shown below) but its too big and there are times
> that I want to just cut out from the text file certain areas to restore data
> in a specific tableā€¦ Looking in the file, I notice there is a "copy"
> command.. Someone told me that there was  a parameter that I could use to
> convert the copy to insert so I could easily cut it out of the file and run
> it on its own ..Any ideas

pg_dump --help says:

  -d, --inserts               dump data as INSERT commands, rather than COPY
  -D, --column-inserts        dump data as INSERT commands with column names

So one of those two commands will output insert commands instead of
copy commands.  note that insert commands tend to run a bit more
slowly, even if you enclose them in a transaction.

In response to

pgsql-sql by date

Next:From: Niklas JohanssonDate: 2008-07-10 16:46:02
Subject: Re: Design and Question
Previous:From: Chris PrestonDate: 2008-07-10 15:40:17
Subject: Converting Copy to insert statement in backup file

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group