username=`$PSQL-d template1 -At-c"SELECT usename FROM pg_shadow WHERE usesysid = ${userid};"`
username="`$PSQL-d template1 -At-c\"SELECT usename FROM pg_shadow WHERE usesysid =${userid};\"`"
echo" ALTER GROUP \"$GRONAME\" ADD USER \"$username\";"
echo" ALTER GROUP \"$GRONAME\" ADD USER \"$username\";"
done
done
done
done
test"$globals_only"=yes&&exit 0
test"$globals_only"=yes&&exit 0
...
@@ -218,10 +221,13 @@ exec 4<&0
...
@@ -218,10 +221,13 @@ exec 4<&0
# We skip databases marked not datallowconn, since we'd be unable to
# We skip databases marked not datallowconn, since we'd be unable to
# connect to them anyway (and besides, we don't want to dump template0).
# connect to them anyway (and besides, we don't want to dump template0).
$PSQL-d template1 -At-F' '\
$PSQL-d template1 -At-F'
-c"SELECT datname, coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), pg_encoding_to_char(d.encoding), datistemplate, datpath FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) WHERE datallowconn ORDER BY 1;" | \
'-c"SELECT datname, coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), pg_encoding_to_char(d.encoding), datistemplate, datpath FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) WHERE datallowconn ORDER BY 1;" | \
while read DATABASE DBOWNER ENCODING ISTEMPLATE DBPATH;do
while read DATABASE ;do
read DBOWNER
read ENCODING
read ISTEMPLATE
read DBPATH
if["$DATABASE"!= template1 ];then
if["$DATABASE"!= template1 ];then
echo
echo
...
@@ -243,8 +249,8 @@ while read DATABASE DBOWNER ENCODING ISTEMPLATE DBPATH; do
...
@@ -243,8 +249,8 @@ while read DATABASE DBOWNER ENCODING ISTEMPLATE DBPATH; do
fi
fi
done
done
$PSQL-d template1 -At-F' '\
$PSQL-d template1 -At-F'
-c"SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;" | \
'-c"SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;" | \