Thread: pg_restore

pg_restore

From
Cesar Schneider
Date:
Hi, I have a dump that was generated with pg_dump in 8.0-beta5 and I'm
trying to restore with pg_restore in 8.0-RC3.

The pg_dump command was: # pg_dump -Ft -o -b database
The pg_restore command was: # pg_restore -Ft -d database

When I execute pg_restore I get this error:
pg_restore: [archiver] unsupported version (1.13) in file header

Dumps created in beta5 are incompatible with rc3 ?
Any suggestion for how can I restore this dump ?

Thank for any help.
Cesar


Re: pg_restore

From
Tom Lane
Date:
Cesar Schneider <cesar@hzta.com.br> writes:
> When I execute pg_restore I get this error:
> pg_restore: [archiver] unsupported version (1.13) in file header

There is no 1.13; you have a corrupt dump file.  Personally I'd bet
money that you ran it through a Windows newline conversion (LF to CR/LF).

            regards, tom lane

Re: pg_restore

From
Cesar Schneider
Date:
I'm still having problems to restore a database.

The dump command used was:

# pg_dump -Ft -b -o database > database.dump

This dump was created in Postgres 8.0beta5 (Windows).

When I try to restore this file in Postgres 8.0-rc3 (Linux) I get this
error:

# pg_restore -Ft -d database database.dump

Using a dump file generated in pgadmin3, works fine... but pgadmin
exports some strange things that are not related to the database.

What can be wrong ?

Cesar


On Mon, 2005-01-17 at 18:42, Tom Lane wrote:
> Cesar Schneider <cesar@hzta.com.br> writes:
> > but is not a plain text dump, so I don't think that is a CRFL problem.
>
> Exactly, but you did something to it with a program that thought it was
> plain text.  The actual current version number is 1.10.  I think it is
> pretty suggestive that LF == 10 decimal and CR == 13 decimal.
>
>             regards, tom lane
>


Re: pg_restore

From
"Niederland"
Date:
I am having the same problem:
System: the released Postgres 8.0, winXP
Install performed an initDB.  Tryed all types of backup/restore
combinations, see below:

Using:
pg_dump --format=t --blobs myDB > DBFile
pg_restore --create -dbname=crm DBFile

Resulted in:
pg_restore: [archiver] unsupported version (1.13) in file header

NOTE:  File was created from pg_dump
and then tried as an input to pg_restore.  File was not viewed or
modified
in any way.

*************
Using:
pg_dump --format=t --blobs myDB > DBFile

Resulted in:
pg_dump: [custom archiver] WARNING: ftell mismatch with expected
position -- ftell used

************
Using:
pg_dump --format=t --blobs myDB > DBFile

Resulted in:
pg_dump: large-object output is not supported for plain-text dump files
pg_dump: <Use a different output format.>
***********

Tom Lane wrote:
> Cesar Schneider <cesar@hzta.com.br> writes:
> > When I execute pg_restore I get this error:
> > pg_restore: [archiver] unsupported version (1.13) in file header
>
> There is no 1.13; you have a corrupt dump file.  Personally I'd bet
> money that you ran it through a Windows newline conversion (LF to
CR/LF).
>
>             regards, tom lane
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html


Re: pg_restore

From
"Niederland"
Date:
More Info:
If I perform a backup of my database with PGAdmin3.  I can restore
the database via the command line pg_restore.  It seems as if the
backup created with pg_restore when issued from a winXP command prompt
does not create a file that the pg_restore can read... At least for the
file types Compress and Tar.  Which I need to use since my database
contains blobs.

One other item:  Issuing an pg_restore -C -d myDB myDB.backup
Did not create the database myDB and complained that the database did
not exist.  I had to first create the database and then the pg_restore
functioned correctly (without -C option).


Re: pg_restore

From
Tom Lane
Date:
"Niederland" <niederland@gmail.com> writes:
> System: the released Postgres 8.0, winXP

> Using:
> pg_dump --format=t --blobs myDB > DBFile
> pg_restore --create -dbname=crm DBFile

> Resulted in:
> pg_restore: [archiver] unsupported version (1.13) in file header

Come to think of it, I'll bet that you cannot use "> DBFile" on Windows
because it ends up opening the archive file in text instead of binary
mode.  SetOutput() in pg_backup_archiver.c tries to work around this by
doing

    fn = fileno(stdout);
    AH->OF = fdopen(dup(fn), PG_BINARY_W);

but it wouldn't surprise me in the least to learn that that doesn't work
on Windows.

Does it work if you use
    pg_dump --format=t --blobs -f DBFile myDB
?  Can anyone on pgsql-hackers-win32 think of a way around this?

            regards, tom lane

Re: [pgsql-hackers-win32] pg_restore

From
Bruce Momjian
Date:
Tom Lane wrote:
> "Niederland" <niederland@gmail.com> writes:
> > System: the released Postgres 8.0, winXP
>
> > Using:
> > pg_dump --format=t --blobs myDB > DBFile
> > pg_restore --create -dbname=crm DBFile
>
> > Resulted in:
> > pg_restore: [archiver] unsupported version (1.13) in file header
>
> Come to think of it, I'll bet that you cannot use "> DBFile" on Windows
> because it ends up opening the archive file in text instead of binary
> mode.  SetOutput() in pg_backup_archiver.c tries to work around this by
> doing
>
>     fn = fileno(stdout);
>     AH->OF = fdopen(dup(fn), PG_BINARY_W);
>
> but it wouldn't surprise me in the least to learn that that doesn't work
> on Windows.
>
> Does it work if you use
>     pg_dump --format=t --blobs -f DBFile myDB
> ?  Can anyone on pgsql-hackers-win32 think of a way around this?

I never considered the distinction of binary/text mode on ">" but I can
see it could certainly be an issue.

Do we have to start suggesting "-f" for all scripts just so Win32 is OK?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_restore

From
"Niederland"
Date:
That worked thanks.  Just can not use the "> DBFile" on windows.