You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# For each database, run pg_dump to dump the contents of that database.
205
205
206
206
$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
-
whileread 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
+
whileread DATABASE DBOWNER ENCODING DBPATH;do
209
209
echo
210
210
echo"--"
211
211
echo"-- Database $DATABASE"
@@ -216,11 +216,17 @@ while read DATABASE DBOWNER ENCODING ; do
216
216
echo"DROP DATABASE \"$DATABASE\";"
217
217
fi
218
218
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
219
226
if [ x"$MULTIBYTE"!= x"" ] ;then
220
-
echo"CREATE DATABASE \"$DATABASE\" WITH ENCODING = '$ENCODING';"
0 commit comments