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

Re: Export/import issue/question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Karl Wright <kwright(at)metacarta(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Export/import issue/question
Date: 2007-06-19 17:12:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Karl Wright <kwright(at)metacarta(dot)com> writes:
> and then I installed 8.1, and attempted the following:
> pg_restore --file dbsnapshot --format=t --table=ingeststatus -a
> But, I get the following error:
> pg_restore: [tar archiver] could not find header for file toc.dat in tar 
> archive

Oh, I'm overthinking the problem.  You left out some details here,
right?  Like it sat and did nothing until you hit control-D?

The above command is wrong because --file is an *output* switch for
pg_restore --- it would have tried to read a tar archive from stdin,
and the "could not find header" complaint is what you get when it hits
immediate EOF and the tar format has been forced on the command line.
(You would have gotten a more recognizable complaint without --format=t,
which is redundant anyway.)  Fortunately, it doesn't seem to try to
write the output file right away, so the dumpfile didn't get trashed.

Correct usage would be something like

pg_restore --table=ingeststatus -a dbsnapshot >restore.sql

or add -d etc switches to issue SQL directly to the target database.

			regards, tom lane

In response to


pgsql-admin by date

Next:From: Kevin GrittnerDate: 2007-06-19 17:27:32
Subject: Re: archive_command does not execute
Previous:From: Karl WrightDate: 2007-06-19 16:53:34
Subject: Re: Export/import issue/question

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