From e08fc14dfb15bf471fdeccba45b5c5516707b463 Mon Sep 17 00:00:00 2001 From: Justin Clift Date: Wed, 9 Oct 2024 13:45:13 +1000 Subject: [PATCH] Use provided POSTGRES_USER environment variable --- pgautoupgrade-postupgrade.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pgautoupgrade-postupgrade.sh b/pgautoupgrade-postupgrade.sh index bb599c3..c31f75f 100755 --- a/pgautoupgrade-postupgrade.sh +++ b/pgautoupgrade-postupgrade.sh @@ -38,7 +38,7 @@ if [ $RUNNING -ne 0 ]; then fi # Get the list of databases in the database cluster -DB_LIST=$(echo 'SELECT datname FROM pg_catalog.pg_database WHERE datistemplate IS FALSE' | psql -1t --csv "${POSTGRES_DB}") +DB_LIST=$(echo 'SELECT datname FROM pg_catalog.pg_database WHERE datistemplate IS FALSE' | psql --username="${POSTGRES_USER}" -1t --csv "${POSTGRES_DB}") # Update query planner statistics echo "----------------------------" @@ -46,7 +46,7 @@ echo "Updating query planner stats" echo "----------------------------" for DATABASE in ${DB_LIST}; do - echo "VACUUM (ANALYZE, VERBOSE, INDEX_CLEANUP FALSE)" | psql -t --csv "${DATABASE}" + echo "VACUUM (ANALYZE, VERBOSE, INDEX_CLEANUP FALSE)" | psql --username="${POSTGRES_USER}" -t --csv "${DATABASE}" done echo "-------------------------------------" @@ -64,7 +64,7 @@ for DATABASE in ${DB_LIST}; do echo "Starting reindex of ${DATABASE}" echo "-------------------------------" - echo 'REINDEX DATABASE CONCURRENTLY' | psql -t --csv "${DATABASE}" + echo 'REINDEX DATABASE CONCURRENTLY' | psql --username="${POSTGRES_USER}" -t --csv "${DATABASE}" echo "-------------------------------" echo "Finished reindex of ${DATABASE}"