Thread: Edit a dump file?

Edit a dump file?

From
Andreas Schlegel
Date:
Hi,

I tried to restore an old database ( "pg_restore -d wh2
wh2.pg_dump.20031011" ), but the restore  failed because of a broken
relation.
The dump was created with "pg_dump -Ft wh2 | gzip >
wh2.pg_dump.20031011.gz".

The message says: "pg_restore: [archiver (db)] could not execute query:
ERROR:  Relation "tcompanystate" does not exist"
Indeed the table was dropped in the meantime and the view was obviously
not corrcted.

My question is: is there change to edit the the dump and remove the
view? I tried to open it with vi. I can read a bit but not all.

Greetings,
Andreas




Re: Edit a dump file?

From
Tom Lane
Date:
Andreas Schlegel <schlegelaw@gmx.de> writes:
> My question is: is there change to edit the the dump and remove the
> view? I tried to open it with vi. I can read a bit but not all.

You can do a selective restore by listing the dump's table of contents
into a file, editing the file, and then using it as a control file for
pg_restore.  See the pg_restore man page.

            regards, tom lane

Re: Edit a dump file?

From
Andreas Schlegel
Date:
Tom,

thanks for the tip. It's running now :-)

Greetings,
Andreas


Tom Lane wrote:

>Andreas Schlegel <schlegelaw@gmx.de> writes:
>
>
>>My question is: is there change to edit the the dump and remove the
>>view? I tried to open it with vi. I can read a bit but not all.
>>
>>
>
>You can do a selective restore by listing the dump's table of contents
>into a file, editing the file, and then using it as a control file for
>pg_restore.  See the pg_restore man page.
>
>            regards, tom lane
>
>
>
>