aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1997-05-14 19:49:34 +0000
committerBruce Momjian <bruce@momjian.us>1997-05-14 19:49:34 +0000
commit2fc04874a61b9d62555d2118cb15e48bc448d0e1 (patch)
treeb7cdcdf0b5ed099e3371c120b4b76eb240a2a0df
parent029873a1098d95b1fe01249010654ab0042540c1 (diff)
downloadpostgresql-2fc04874a61b9d62555d2118cb15e48bc448d0e1.tar.gz
postgresql-2fc04874a61b9d62555d2118cb15e48bc448d0e1.zip
Allow pg_dumpall to preserve database ownership.
-rw-r--r--src/bin/pg_dump/pg_dumpall7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_dumpall b/src/bin/pg_dump/pg_dumpall
index ff10a2a0daf..2cf83c3be11 100644
--- a/src/bin/pg_dump/pg_dumpall
+++ b/src/bin/pg_dump/pg_dumpall
@@ -5,18 +5,19 @@
# It also dumps the pg_user table
#
# to adapt to System V vs. BSD 'echo'
-set -x
+#set -x
if echo '\\' | grep '\\\\' >/dev/null 2>&1
then
BS='\' # BSD
else
BS='\\' # System V
fi
-psql -l -A -q -t|cut -d"|" -f1 | grep -v '^template1$' | \
-while read DATABASE
+psql -l -A -q -t|cut -d"|" -f1-2 | tr '|' ' ' | grep -v '^template1 ' | \
+while read DATABASE USER
do
echo "${BS}connect template1"
echo "create database $DATABASE;"
+ echo "update pg_database set datdba = $USER where datname = '$DATABASE';"
echo "${BS}connect $DATABASE"
pg_dump "$@" $DATABASE
done