Resolve "ssh vs linux user: if no `-U` specified, something unpredictable happens"
requested to merge 312-ssh-vs-linux-user-if-no-u-specified-something-unpredictable-happens into master
Description
- Don't add
--username
to_PSQL
(wrapper) if the argument is not given - Do not print whole help after error (better attention to error)
- Improve example with ssh username
Related issue
Examples
[[ "${USERNAME}" = "None" ]] && export USERNAME=""
...
# use default Postgres username or not
local user_substr=""
if [[ ! -z ${USERNAME+x} ]]; then
user_substr=" -U \"${USERNAME}\" "
fi
# Construct _PSQL macro for usage inside the check scripts
export PGOPTIONS="-c statement_timeout=${STIMEOUT}s"
export PSQL_CONN_OPTIONS="--port=${PGPORT} --dbname=${DBNAME} ${user_substr} ${psql_unix_socket_option}"
export _PSQL="PGOPTIONS=\"${PGOPTIONS}\" ${pgpas_subst}${psql_bin} -1 -X -At -q -v ON_ERROR_STOP=1 -P pager=off ${PSQL_CONN_OPTIONS}"
Closes #312 (closed)
Edited by Victor Yagofarov