Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d97a61

Browse files
committed
Added pg_dumpall to source tree.
1 parent3a02ccf commit3d97a61

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

‎src/bin/pg_dump/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.11 1996/11/28 03:31:27 bryanh Exp $
10+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.12 1997/01/16 15:28:21 momjian Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -35,6 +35,7 @@ submake:
3535

3636
install: pg_dump
3737
$(INSTALL)$(INSTL_EXE_OPTS) pg_dump$(DESTDIR)$(BINDIR)/pg_dump
38+
$(INSTALL)$(INSTL_EXE_OPTS) pg_dumpall$(DESTDIR)$(BINDIR)/pg_dumpall
3839

3940
dependdep:
4041
$(CC) -MM$(INCLUDE_OPT)*.c>depend

‎src/bin/pg_dump/pg_dumpall

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
#
3+
# pg_dumpall [pg_dump parameters]
4+
# dumps all databases to standard output
5+
# It also dumps the pg_user table
6+
#
7+
psql -l -A -q -t|unesc|cut -d"|" -f1| grep -v'^template1$'| \
8+
whileread DATABASE
9+
do
10+
/bin/echo'\connect template1'
11+
/bin/echo"create database$DATABASE;"
12+
/bin/echo'\connect'"$DATABASE"
13+
pg_dump"$@"$DATABASE
14+
done
15+
/bin/echo'\connect template1'
16+
/bin/echo'copy pg_user from stdin;'
17+
#
18+
# Dump everyone but the postgres user
19+
# initdb creates him
20+
#
21+
POSTGRES_SUPER_USER_ID="`psql -q template1<<END
22+
\\t
23+
select datdba
24+
from pg_database
25+
where datname = 'template1';
26+
END`"
27+
psql -q template1 <<END
28+
select pg_user.* into table tmp_pg_user
29+
from pg_user
30+
where usesysid <>$POSTGRES_SUPER_USER_ID;
31+
copy tmp_pg_user to stdout;
32+
drop table tmp_pg_user;
33+
END
34+
/bin/echo '\.'
35+
36+

‎src/man/pg_dumpall.1

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp