Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c6d103a

Browse files
committed
Dump identity of alternative location, if any.
1 parent 929a599 commit c6d103a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/bin/pg_dump/pg_dumpall.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# and "pg_group" tables, which belong to the whole installation rather
77
# than any one individual database.
88
#
9-
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.6 2000/11/02 21:13:32 petere Exp $
9+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.7 2000/11/08 18:23:44 petere Exp $
1010

1111
CMDNAME=`basename $0`
1212

@@ -204,8 +204,8 @@ fi
204204
# For each database, run pg_dump to dump the contents of that database.
205205

206206
$PSQL -d template1 -At -F ' ' \
207-
-c "SELECT d.datname, u.usename, pg_encoding_to_char(d.encoding) FROM pg_database d, pg_shadow u WHERE d.datdba = u.usesysid AND datname <> 'template1';" | \
208-
while read DATABASE DBOWNER ENCODING ; do
207+
-c "SELECT d.datname, u.usename, pg_encoding_to_char(d.encoding), d.datpath FROM pg_database d, pg_shadow u WHERE d.datdba = u.usesysid AND datname <> 'template1';" | \
208+
while read DATABASE DBOWNER ENCODING DBPATH; do
209209
echo
210210
echo "--"
211211
echo "-- Database $DATABASE"
@@ -216,11 +216,17 @@ while read DATABASE DBOWNER ENCODING ; do
216216
echo "DROP DATABASE \"$DATABASE\";"
217217
fi
218218

219+
createdbcmd="CREATE DATABASE \"$DATABASE\""
220+
if [ x"$DBPATH" != x"" ] || [ x"$MULTIBYTE" != x"" ]; then
221+
createdbcmd="$createdbcmd WITH"
222+
fi
223+
if [ x"$DBPATH" != x"" ] ; then
224+
createdbcmd="$createdbcmd LOCATION = '$DBPATH'"
225+
fi
219226
if [ x"$MULTIBYTE" != x"" ] ; then
220-
echo "CREATE DATABASE \"$DATABASE\" WITH ENCODING = '$ENCODING';"
221-
else
222-
echo "CREATE DATABASE \"$DATABASE\";"
227+
createdbcmd="$createdbcmd ENCODING = '$ENCODING'"
223228
fi
229+
echo "$createdbcmd;"
224230

225231
echo "${BS}connect $DATABASE $DBOWNER"
226232
$PGDUMP "$DATABASE"

0 commit comments

Comments
 (0)