From 3d97a61a60f52e400891ee0c8f161920277a130a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 16 Jan 1997 15:28:34 +0000 Subject: [PATCH] Added pg_dumpall to source tree. --- src/bin/pg_dump/Makefile | 3 ++- src/bin/pg_dump/pg_dumpall | 36 ++++++++++++++++++++++++++++++++++++ src/man/pg_dumpall.1 | 17 +++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/bin/pg_dump/pg_dumpall create mode 100644 src/man/pg_dumpall.1 diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile index 6a79dd0594..97d50c4084 100644 --- a/src/bin/pg_dump/Makefile +++ b/src/bin/pg_dump/Makefile @@ -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 diff --git a/src/bin/pg_dump/pg_dumpall b/src/bin/pg_dump/pg_dumpall new file mode 100644 index 0000000000..854622043d --- /dev/null +++ b/src/bin/pg_dump/pg_dumpall @@ -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 < $POSTGRES_SUPER_USER_ID; +copy tmp_pg_user to stdout; +drop table tmp_pg_user; +END +/bin/echo '\.' + + diff --git a/src/man/pg_dumpall.1 b/src/man/pg_dumpall.1 new file mode 100644 index 0000000000..d7eec0a2da --- /dev/null +++ b/src/man/pg_dumpall.1 @@ -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)