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

Commit3d14618

Browse files
committed
Dump contents of pg_group along with pg_shadow.
1 parent570a58f commit3d14618

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

‎src/bin/pg_dump/pg_dumpall

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
#
33
# pg_dumpall [pg_dump parameters]
44
# dumps all databases to standard output
5-
# It also dumps the pg_shadow table
5+
# It also dumps the pg_shadow and pg_group tables, which belong to the
6+
# whole installation rather than any one individual database.
7+
#
8+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall,v 1.25 2000/05/05 03:04:00 tgl Exp $
69
#
710
# to adapt to System V vs. BSD 'echo'
8-
#set -x
911
ifecho'\\'| grep'\\\\'>/dev/null2>&1
1012
then
1113
BS='\'# BSD
@@ -36,6 +38,8 @@ echo "delete from pg_shadow where usesysid <> tmp_pg_shadow.datdba;"
3638
echo"drop table tmp_pg_shadow;"
3739
#
3840
# load all the non-postgres users
41+
# XXX this breaks badly if the layout of pg_shadow ever changes.
42+
# It'd be better to convert the data into CREATE USER commands.
3943
#
4044
echo"copy pg_shadow from stdin;"
4145
psql -q template1 <<END
@@ -47,6 +51,19 @@ copy tmp_pg_shadow to stdout;
4751
drop table tmp_pg_shadow;
4852
END
4953
echo"${BS}."
54+
#
55+
# copy the pg_group table too
56+
# XXX this breaks badly if the layout of pg_group ever changes.
57+
# It'd be better to convert the data into CREATE GROUP commands.
58+
#
59+
echo"copy pg_group from stdin;"
60+
psql -q template1 <<END
61+
copy pg_group to stdout;
62+
END
63+
echo"${BS}."
64+
#
65+
# For each database, run pg_dump to dump the contents of that database.
66+
#
5067
psql -A -q -t -c"select* from pg_database" template1 | grep '|' | tr '|' ' ' |\
5168
grep -v '^template1 ' |\
5269
while read DATABASE DBUSERID ENCODING DATAPATH
@@ -73,3 +90,5 @@ do
7390
exit 1
7491
fi
7592
done
93+
94+
exit 0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp