Skip site navigation (1) Skip section navigation (2)

Re: Bug #631: pg_dumpall does not accept -F or -f

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Donald A Pellegrino <Donald(dot)A(dot)Pellegrino(at)USA(dot)dupont(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>,pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #631: pg_dumpall does not accept -F or -f
Date: 2002-04-11 16:41:48
Message-ID: 200204111641.g3BGfmK06786@candle.pha.pa.us (view raw or flat)
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)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

Next:From: Tom LaneDate: 2002-04-11 16:44:31
Subject: Re: Bug #631: pg_dumpall does not accept -F or -f
Previous:From: Donald A PellegrinoDate: 2002-04-11 16:23:18
Subject: Re: Bug #631: pg_dumpall does not accept -F or -f

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group