summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1997-01-19 10:15:59 +0000
committerBruce Momjian <bruce@momjian.us>1997-01-19 10:15:59 +0000
commit604f4a692805ace6c094cd21ae3aaba9dc9747b2 (patch)
tree42fd8879c51d415a4eee8e1877ed74ab6e881f76 /src
parent6ffae202a9bc95f5c1ed20c40f86c2d2ee5e7db5 (diff)
Update handling of backslashes, and pg_user dump.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dumpall23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/bin/pg_dump/pg_dumpall b/src/bin/pg_dump/pg_dumpall
index cf1fd6199b3..ff10a2a0daf 100644
--- a/src/bin/pg_dump/pg_dumpall
+++ b/src/bin/pg_dump/pg_dumpall
@@ -4,22 +4,29 @@
# dumps all databases to standard output
# It also dumps the pg_user table
#
+# to adapt to System V vs. BSD 'echo'
+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
do
- /bin/echo '\connect template1'
- /bin/echo "create database $DATABASE;"
- /bin/echo '\connect' "$DATABASE"
+ echo "${BS}connect template1"
+ echo "create database $DATABASE;"
+ echo "${BS}connect $DATABASE"
pg_dump "$@" $DATABASE
done
-/bin/echo '\connect template1'
-/bin/echo 'copy pg_user from stdin;'
+echo "${BS}connect template1"
+echo "copy pg_user from stdin;"
#
# Dump everyone but the postgres user
# initdb creates him
#
-POSTGRES_SUPER_USER_ID="`psql -q template1 <<END
-\\t
+POSTGRES_SUPER_USER_ID="`psql -A -q -t template1 <<END
select datdba
from pg_database
where datname = 'template1';
@@ -31,4 +38,4 @@ where usesysid <> $POSTGRES_SUPER_USER_ID;
copy tmp_pg_user to stdout;
drop table tmp_pg_user;
END
-/bin/echo '\.'
+echo "${BS}."