Re: Bug #631: pg_dumpall does not accept -F or -f - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: Bug #631: pg_dumpall does not accept -F or -f
Date
Msg-id 200204111641.g3BGfmK06786@candle.pha.pa.us
Whole thread Raw
List pgsql-bugs
I think the bigger problem is that once you concatenate the custom
format for multiple databases into a single file, how does pg_restore
recognize where one database stops and another starts.  I think the only
solution is to put the binary dumps in separate files, perhaps like
this:

    psql -l | while read DB
    do
        pg_dump --data-only --format=c --oids --blobs $DB > $DB.out
    done

I can't see another way.

---------------------------------------------------------------------------

Donald A Pellegrino wrote:
>
> Thanks for the quick response.  I see that pg_dumpall outputs the global
> objects (-g) to stdout and that it cannot be combined with the -F or -f for
> this reason.  I would still like to be able to do a full database backup,
> including all databases with oids and blobs, from a generic shell script
> that did not know about which databases existed.  Under the current set of
> utilities this does not seem to be possible without coding the script to
> run:
>
> pg_dump --oids --blobs --format=c
>
> for each database and sending each database to it's own backup file.  By
> modifying the logic of the pg_dumpall script a solution might be possible.
> I propose the following backup logic:
>
> 1. Backup all the globals to a text file.
>
> pg_dumpall --globals-only > globals.dump
>
> 2. Backup all the schemas to a text file, don't output globals.
>
> pg_dumpall --schema-only > schema.dump
>
> 3. Backup all the databases to a custom file, don't output globals.
>
> pg_dumpall --data-only --format=c --oids --blobs > data.dump
>
> This presumes however that the custom file formats output by each pg_dump
> for a database can be concatenated into a single file.  Is this possible?
>
> If so, pg_dumpall would only need to detect --globals-only.  If it is used
> then output global information to stdio.  If it is not present then call
> pg_dump for each database with the full set of parameters given and don't
> output anything from pg_dumpall.
>
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-bugs by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Bug #630: date/time storage problem: timestamp parsed
Next
From: Tom Lane
Date:
Subject: Re: Bug #631: pg_dumpall does not accept -F or -f