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

Commit604f4a6

Browse files
committed
Update handling of backslashes, and pg_user dump.
1 parent6ffae20 commit604f4a6

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

‎src/bin/pg_dump/pg_dumpall

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,29 @@
44
# dumps all databases to standard output
55
# It also dumps the pg_user table
66
#
7+
# to adapt to System V vs. BSD 'echo'
8+
set -x
9+
ifecho'\\'| grep'\\\\'>/dev/null2>&1
10+
then
11+
BS='\'# BSD
12+
else
13+
BS='\\'# System V
14+
fi
715
psql -l -A -q -t|cut -d"|" -f1| grep -v'^template1$'| \
816
whileread DATABASE
917
do
10-
/bin/echo'\connect template1'
11-
/bin/echo"create database$DATABASE;"
12-
/bin/echo'\connect'"$DATABASE"
18+
echo"${BS}connect template1"
19+
echo"create database$DATABASE;"
20+
echo"${BS}connect$DATABASE"
1321
pg_dump"$@"$DATABASE
1422
done
15-
/bin/echo'\connect template1'
16-
/bin/echo'copy pg_user from stdin;'
23+
echo"${BS}connect template1"
24+
echo"copy pg_user from stdin;"
1725
#
1826
# Dump everyone but the postgres user
1927
# initdb creates him
2028
#
21-
POSTGRES_SUPER_USER_ID="`psql -q template1<<END
22-
\\t
29+
POSTGRES_SUPER_USER_ID="`psql -A -q -t template1<<END
2330
select datdba
2431
from pg_database
2532
where datname = 'template1';
@@ -31,4 +38,4 @@ where usesysid <> $POSTGRES_SUPER_USER_ID;
3138
copy tmp_pg_user to stdout;
3239
drop table tmp_pg_user;
3340
END
34-
/bin/echo'\.'
41+
echo"${BS}."

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp