Thread: pg_restore valid archive

pg_restore valid archive

From
eel@javabox.com (Eel)
Date:
Hi,
  I'm trying to upgrade to 7.2 from 7.0.  I first tried pg_dump from
7.0 and then pg_restore.  It gave me "input file does not appear to be
a valid archive". I did a bit of research and found that versions of
pg_dump/restore are incompatible, so I pg_dumped it from the 7.2
pg_dump.  It still gives me the same error.  What do I need for a
valid archive?  I'm doing something like:

pg_dump -h oldmachine mydb > pgmydb

None of the following work.
pg_restore pgmydb
pg_restore -d mydb pgmydb
pg_restore -d mydb -f pgmydb

Is there any trick to doing this?  I can't even dump/restore a simple
database on the new machine.

Thanks!

Re: pg_restore valid archive

From
eel@javabox.com (Eel)
Date:
So I used:

psql mydb < pgmydb

and it worked like a charm.

What's the deal with pg_restore? Is it just noise?  The
docs show it working.  Not a big deal, but I can't get it
to work.

Thanks.

eel@javabox.com (Eel) wrote in message news:<a62a408.0202151814.15a4dcc@posting.google.com>...
> Hi,
>   I'm trying to upgrade to 7.2 from 7.0.  I first tried pg_dump from
> 7.0 and then pg_restore.  It gave me "input file does not appear to be
> a valid archive". I did a bit of research and found that versions of
> pg_dump/restore are incompatible, so I pg_dumped it from the 7.2
> pg_dump.  It still gives me the same error.  What do I need for a
> valid archive?  I'm doing something like:
>
> pg_dump -h oldmachine mydb > pgmydb
>
> None of the following work.
> pg_restore pgmydb
> pg_restore -d mydb pgmydb
> pg_restore -d mydb -f pgmydb
>
> Is there any trick to doing this?  I can't even dump/restore a simple
> database on the new machine.
>
> Thanks!

Re: pg_restore valid archive

From
Doug McNaught
Date:
eel@javabox.com (Eel) writes:

> Hi,
>   I'm trying to upgrade to 7.2 from 7.0.  I first tried pg_dump from
> 7.0 and then pg_restore.  It gave me "input file does not appear to be
> a valid archive". I did a bit of research and found that versions of
> pg_dump/restore are incompatible, so I pg_dumped it from the 7.2
> pg_dump.  It still gives me the same error.  What do I need for a
> valid archive?  I'm doing something like:

If you're dumping in straight SQL format (the default), just use
'psql' to do the restore:

$ psql -f <dumpfile> <dbname>

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

Re: pg_restore valid archive

From
Doug McNaught
Date:
eel@javabox.com (Eel) writes:

> So I used:
>
> psql mydb < pgmydb
>
> and it worked like a charm.
>
> What's the deal with pg_restore? Is it just noise?  The
> docs show it working.  Not a big deal, but I can't get it
> to work.

It only works with the '-Ft' and '-Fc' dump formats, since they're not
plain SQL.  Maybe the docs could be clearer...

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

Re: pg_restore valid archive

From
Oliver Elphick
Date:
On Sat, 2002-02-16 at 15:06, Eel wrote:
> What's the deal with pg_restore? Is it just noise?  The
> docs show it working.  Not a big deal, but I can't get it
> to work.

You weren't using the -F option to pg_dump.  According to the reference
manual, that is necessary to make an archive that pg_restore can read.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "My sheep hear my voice, and I know them, and they
      follow me; And I give unto them eternal life; and they
      shall never perish, neither shall any man pluck them
      out of my hand."          John 10:27,28