Added pg_dumpall to source tree.

This commit is contained in:
Bruce Momjian 1997-01-16 15:28:34 +00:00
parent 3a02ccfa1d
commit 3d97a61a60
3 changed files with 55 additions and 1 deletions

View File

@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.11 1996/11/28 03:31:27 bryanh Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.12 1997/01/16 15:28:21 momjian Exp $
#
#-------------------------------------------------------------------------
@ -35,6 +35,7 @@ submake:
install: pg_dump
$(INSTALL) $(INSTL_EXE_OPTS) pg_dump $(DESTDIR)$(BINDIR)/pg_dump
$(INSTALL) $(INSTL_EXE_OPTS) pg_dumpall $(DESTDIR)$(BINDIR)/pg_dumpall
depend dep:
$(CC) -MM $(INCLUDE_OPT) *.c >depend

View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# pg_dumpall [pg_dump parameters]
# dumps all databases to standard output
# It also dumps the pg_user table
#
psql -l -A -q -t|unesc|cut -d"|" -f1 | grep -v '^template1$' | \
while read DATABASE
do
/bin/echo '\connect template1'
/bin/echo "create database $DATABASE;"
/bin/echo '\connect' "$DATABASE"
pg_dump "$@" $DATABASE
done
/bin/echo '\connect template1'
/bin/echo 'copy pg_user from stdin;'
#
# Dump everyone but the postgres user
# initdb creates him
#
POSTGRES_SUPER_USER_ID="`psql -q template1 <<END
\\t
select datdba
from pg_database
where datname = 'template1';
END`"
psql -q template1 <<END
select pg_user.* into table tmp_pg_user
from pg_user
where usesysid <> $POSTGRES_SUPER_USER_ID;
copy tmp_pg_user to stdout;
drop table tmp_pg_user;
END
/bin/echo '\.'

17
src/man/pg_dumpall.1 Normal file
View File

@ -0,0 +1,17 @@
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dumpall.1,v 1.1 1997/01/16 15:28:34 momjian Exp $
.TH pg_dumpall UNIX 1/20/96 PostgreSQL PostgreSQL
.SH NAME
pg_dumpall \(em dumps out all Postgres databases into a script file
.SH SYNOPSIS
.BR pg_dumpall
[pg_dump options]
.SH DESCRIPTION
.IR "pg_dumpall"
is a utility for dumping out all Postgres databases into one file.
It also dumps the pg_user table, which is global to all databases.
pg_dumpall takes all pg_dump options, but \fB-f\fR and \fBdbname\fR
should not be used.
.SH "SEE ALSO"
pg_dump(1)