Re: pg_ [dump & restore] invalid archive problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John-Paul Delaney" <John-Paul(dot)Delaney(at)wfp(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: pg_ [dump & restore] invalid archive problem
Date: 2004-11-04 15:17:28
Message-ID: 25466.1099581448@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"John-Paul Delaney" <John-Paul(dot)Delaney(at)wfp(dot)org> writes:
> Using the command syntax directly from man pg_dump:
> pg_dump -Ft -b mydb > mydb.tar
> pg_restore -d mydb mydb.tar
> I invariably (tried various attempts) get the following error:
> "pg_restore: [archiver] input file does not appear to be a valid archive"

Which PG version are you using? There was a bug for awhile that would
cause pg_restore to fail to identify tar-format archives automatically,
so you had to specify -Ft at restore time too:
pg_restore -Ft -d mydb mydb.tar

Other than that, this looks right to me. The nearby suggestion to use
psql is definitely wrong --- you use psql for plain-text dumps, but
pg_restore for -Ft and -Fc dumps.

(BTW, in general I'd recommend -Fc over -Ft, unless you have some
compelling reason to want to look at the dump with tools other than
pg_restore. The custom-format code is better tested, for one thing, as
evidenced by the fact that this bug went undetected for a good while.)

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Kjetil Haaland 2004-11-04 15:35:11 Re: c extension
Previous Message John-Paul Delaney 2004-11-04 13:44:21 Re: pg_ [dump & restore] invalid archive problem