From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org, Andreas Laggner <andreas(dot)laggner(at)vti(dot)bund(dot)de> |
Subject: | Re: Upgrading 8.2 to 8.4: pg_restore: did not find magic string in file header\n |
Date: | 2010-11-19 19:00:47 |
Message-ID: | 4CE6C95F.7090001@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 11/19/2010 09:54 AM, Tom Lane wrote:
> Adrian Klaver<adrian(dot)klaver(at)gmail(dot)com> writes:
>> On Friday 19 November 2010 8:29:38 am Tom Lane wrote:
>>> It sounds like you're trying to use pg_restore on a plain-text (SQL
>>> script) dump file. Run it through psql, instead.
>
>> Out of curiosity what would trigger this? When I have tried to run a
>> plain text file through pg_restore I get:
>
>> aklaver(at)tucker:~$ pg_restore -d test -U postgres test.sql
>> pg_restore: [archiver] input file does not appear to be a valid archive
>
> Yeah, that's what you get if you let pg_restore try to determine the
> file type. If you tell it you know that the file is an archive (-Fc)
> then it believes you, and you get the lower-level failure.
>
> I'm not real sure why we honor -Fc and -Ft in pg_restore anyway;
> skipping the file type check couldn't possibly save enough to be
> worth the trouble ...
>
> regards, tom lane
Now I understand. I wonder if this would be a good time to ask about
whether pg_restore could be made to work with plain-text files:)
Maybe use the below for the magic string?
--
-- PostgreSQL database dump
--
I realize some of the options to pg_restore would be no-ops in this
case. Though I could see a shortcut that passes a plain text file to
psql or at least creates an error message that says:
"Please use psql with the -f option to restore this file"
It just seems that quite a few people are caught by the asymmetrical
nature of pg_dump/pg_restore i.e. pg_dump can create a file that
pg_restore cannot restore.
Thanks,
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-11-19 19:09:07 | Re: Regarding EXPLAIN and width calculations |
Previous Message | John R Pierce | 2010-11-19 18:50:27 | Re: tablespace restore |