Skip to content

fix: only grant pg_read_all_data if it exists #1242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ begin
, case when rec.grantee = 'postgres'::regrole then 'supabase_admin'
when rec.grantee = 'supabase_admin'::regrole then 'postgres'
when rec.grantee = 0 then 'public'
else rec.grantee::regrole
else rec.grantee::regrole::text
end
));
end if;
Expand All @@ -383,7 +383,7 @@ begin
when obj->>'objtype' = 'T' then 'types'
when obj->>'objtype' = 'n' then 'schemas'
end
, case when rec.grantee = 0 then 'public' else rec.grantee::regrole end
, case when rec.grantee = 0 then 'public' else rec.grantee::regrole::text end
, case when rec.is_grantable then 'with grant option' else '' end
));
end if;
Expand Down Expand Up @@ -530,7 +530,14 @@ $$;
alter database postgres connection limit -1;

-- #incident-2024-09-12-project-upgrades-are-temporarily-disabled
grant pg_read_all_data, pg_signal_backend to postgres;
do $$
begin
if exists (select from pg_authid where rolname = 'pg_read_all_data') then
execute('grant pg_read_all_data to postgres');
end if;
end
$$;
grant pg_signal_backend to postgres;

set session authorization supabase_admin;
drop role supabase_tmp;
Expand Down
Loading