Skip to content

Commit

Permalink
Add GRANT to set the session parameter to voyager user in fallback if…
Browse files Browse the repository at this point in the history
… PG >= 15
  • Loading branch information
priyanshi-yb committed Feb 14, 2025
1 parent 184ef57 commit fbca145
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,14 @@ GRANT pg_read_all_stats to :voyager_user;
WHERE
schema_name = ANY(string_to_array(:'schema_list', ','))
\gexec

DO $$
BEGIN
IF (substring((SELECT setting FROM pg_catalog.pg_settings WHERE name = 'server_version'), '^[0-9]+')::int >= 15) THEN
RAISE NOTICE 'Granting set on PARAMETER session_replication_role TO %;', current_setting('myvars.voyager_user');
EXECUTE format('GRANT SET ON PARAMETER session_replication_role TO %I;', current_setting('myvars.voyager_user'));
END IF;
END $$;

\endif
\endif

0 comments on commit fbca145

Please sign in to comment.