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

Commit69cc16f

Browse files
committed
Quote database name so that not-all-lowercase names are handled safely.
1 parent61f5e13 commit69cc16f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎src/bin/pg_dump/pg_dumpall

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# It also dumps the pg_shadow and pg_group tables, which belong to the
66
# whole installation rather than any one individual database.
77
#
8-
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall,v 1.26 2000/05/05 17:50:38 tgl Exp $
8+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall,v 1.27 2000/05/25 20:18:15 tgl Exp $
99
#
1010
# to adapt to System V vs. BSD 'echo'
1111
ifecho'\\'| grep'\\\\'>/dev/null2>&1
@@ -65,9 +65,9 @@ echo "${BS}."
6565
#
6666
# For each database, run pg_dump to dump the contents of that database.
6767
#
68-
psql -A -q -t -c"select* from pg_database" template1 | grep '|' | tr '|' ' ' |\
68+
psql -A -q -t -c"selectdatname,datdba,encoding from pg_database" template1 | grep '|' | tr '|' ' ' |\
6969
grep -v '^template1 ' |\
70-
while read DATABASE DBUSERID ENCODING DATAPATH
70+
while read DATABASE DBUSERID ENCODING
7171
do
7272
DBUSERNAME="`echo\" \
7373
selectusename \
@@ -79,13 +79,13 @@ do
7979
8080
if sh -c"pg_encoding$ENCODING" >/dev/null 2>&1
8181
then
82-
echo"create database$DATABASE with encoding='`pg_encoding $ENCODING`';"
82+
echo"create database\"$DATABASE\" with encoding='`pg_encoding $ENCODING`';"
8383
else
84-
echo"create database$DATABASE;"
84+
echo"create database\"$DATABASE\";"
8585
fi
8686
87-
echo"${BS}connect$DATABASE$POSTGRES_USER"
88-
pg_dump${1+"$@"}$DATABASE
87+
echo"${BS}connect$DATABASE$DBUSERNAME"
88+
pg_dump${1+"$@"}"$DATABASE"
8989
if ["$?" -ne 0 ]
9090
thenecho"pg_dump failed on$DATABASE, exiting" 1>&2
9191
exit 1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp