Converting Copy to insert statement in backup file
Converting Copy to insert statement in backup file
От:
"Chris Preston" <chris@thetrafalgartravel.com>
Дата:
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
su -c '/usr/bin/pg_dump -U postgres -o -C ttms |gzip > /home/hrd/ttmsqltrams/sqlbackup.gz' postgres
Re: Converting Copy to insert statement in backup file
От:
"Scott Marlowe" <scott.marlowe@gmail.com>
Дата:
On Thu, Jul 10, 2008 at 9:40 AM, Chris Preston 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.