Skip to content

Commit

Permalink
postgresql: Grant postgres role to eda
Browse files Browse the repository at this point in the history
During the postgresql upgrade, we need to grant temporary the postgres
role to the eda postgresql user and remove it after the pg_restore is
over.

pg_restore: error: could not execute query: ERROR:  must be member of role "postgres"
Command was: ALTER SCHEMA public OWNER TO postgres;

Signed-off-by: Dimitri Savineau <[email protected]>
  • Loading branch information
dsavineau committed Mar 25, 2024
1 parent 409c243 commit c2b13fd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions roles/postgres/tasks/upgrade_postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@
trap 'end_keepalive \"$keepalive_file\" \"$keepalive_pid\"' EXIT SIGINT SIGTERM
echo keepalive_pid: $keepalive_pid
set -e -o pipefail
psql -c 'GRANT postgres TO {{ eda_postgres_user }}'
PGPASSWORD=\"$POSTGRES_PASSWORD\" {{ pgdump }} | PGPASSWORD=\"$POSTGRES_PASSWORD\" {{ pg_restore }}
psql -c 'REVOKE postgres FROM {{ eda_postgres_user }}'
set +e +o pipefail
echo 'Successful'
"
Expand Down

0 comments on commit c2b13fd

Please sign in to comment.