[type/__postgres_role] Always set psql -q

This commit is contained in:
Dennis Camera 2020-12-17 17:05:58 +01:00
parent 1180f13ed6
commit 99d82fd0d5
2 changed files with 4 additions and 4 deletions

View file

@ -37,7 +37,7 @@ rolename=${__object_id:?}
psql_query() {
su -l "${postgres_user}" -c "$(
printf "psql -F '\034' -R '\036' -wAc '%s'" \
printf "psql -q -F '\034' -R '\036' -wAc '%s'" \
"$(printf %s "$*" | sed "s/'/'\\\\''/g")"
)"
}
@ -46,7 +46,7 @@ password_check_login() (
PGPASSWORD=$(cat "${__object:?}/parameter/password"; printf .)
PGPASSWORD=${PGPASSWORD%?.}
export PGPASSWORD
psql -w -h localhost -U "${rolename}" template1 -c '\q' >/dev/null 2>&1
psql -q -w -h localhost -U "${rolename}" template1 -c '\q' >/dev/null 2>&1
)
role_properties=$(

View file

@ -54,7 +54,7 @@ fi
psql_query() {
printf 'su -l %s -c %s\n' \
"$(quote "${postgres_user}")" \
"$(quote "psql postgres -wc $(quote "$1")")"
"$(quote "psql postgres -q -w -c $(quote "$1")")"
}
psql_set_password() {
@ -63,7 +63,7 @@ psql_set_password() {
then
cat <<-EOF
exec 3< "\${__object:?}/parameter/password"
su -l '${postgres_user}' -c 'psql -q postgres -w' <<'SQL'
su -l '${postgres_user}' -c 'psql -q -w postgres' <<'SQL'
\set HISTFILE /dev/null
\set pw \`cat <&3\`
ALTER ROLE "${rolename}" WITH PASSWORD :'pw';