Edit a dump file?

Started by Andreas Schlegelabout 23 years ago3 messagesgeneral
Jump to latest
#1Andreas Schlegel
schlegelaw@gmx.de

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andreas Schlegel (#1)
Re: Edit a dump file?

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

#3Andreas Schlegel
schlegelaw@gmx.de
In reply to: Andreas Schlegel (#1)
Re: Edit a dump file?

Tom,

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

Greetings,
Andreas

Tom Lane wrote:

Show quoted text

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