mirror of https://github.com/postgres/postgres
parent
3a02ccfa1d
commit
3d97a61a60
@ -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 '\.' |
||||
|
||||
|
||||
@ -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) |
||||
Loading…
Reference in new issue