Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>>>> echo 'some custom header' >pg.dump
>>>> pg_dump -Fc >>pg.dump
> IIRC pg_restore expects the archive to begin with the header and TOC
> produced by pg_dump. Maybe I'm being dense, but I'm not able to see how
> prefixing that with something else could possibly do something useful or
> workable.
You'd have to do something like
(1) open the file as stdin(2) read the custom header(3) exec pg_restore, telling it to read stdin
A possible application for this would be for the header to contain
information needed to prepare pg_restore's arguments, like where to
contact the server. I still think it's a bit too klugy to justify
the effort though.
In a more abstract sense, what this would be is basically a custom
label for a dump file. I could see that being useful, but if we
wanted to support it then it ought to be an actual Feature and not
a kluge like this. Something like
pg_dump --label 'any string' ... other args ...
pg_restore --print-label dump.file
regards, tom lane