Skip to content

Commit eb64faa

Browse files
committed
fix: also grant pg_create_subscription & pg_monitor post-upgrade
1 parent 4039e4c commit eb64faa

File tree

1 file changed

+15
-1
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+15
-1
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/complete.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,21 @@ EOF
255255
)
256256
run_sql -c "$REENCRYPT_VAULT_SECRETS_QUERY"
257257

258-
run_sql -c "grant pg_read_all_data, pg_signal_backend to postgres"
258+
GRANT_PREDEFINED_ROLES_TO_POSTGRES_QUERY=$(cat <<EOF
259+
DO \$\$
260+
DECLARE
261+
major_version INT;
262+
BEGIN
263+
SELECT current_setting('server_version_num')::INT / 10000 INTO major_version;
264+
IF major_version >= 16 THEN
265+
GRANT pg_create_subscription TO postgres;
266+
END IF;
267+
GRANT pg_monitor, pg_read_all_data, pg_signal_backend TO postgres;
268+
END
269+
\$\$;
270+
EOF
271+
)
272+
run_sql -c "$GRANT_PREDEFINED_ROLES_TO_POSTGRES_QUERY"
259273
}
260274

261275
function complete_pg_upgrade {

0 commit comments

Comments
 (0)