On 11/19/2010 09:54 AM, Tom Lane wrote:
Adrian Klaver<adrian.kla...@gmail.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:

akla...@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.kla...@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to