Skip to content

Commit e796aad

Browse files
committed
feat: grant predefined roles to postgres
Decouples some changes from https://github.com/supabase/postgres/pull/994/files `postgres` can already grant these roles to itself; granting these by default removes one step if users need to read Storage migrations, kill running queries from non-superusers, etc.
1 parent 53764b3 commit e796aad

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- migrate:up
2+
grant pg_read_all_data, pg_signal_backend to postgres;
3+
4+
-- migrate:down

migrations/tests/database/privs.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
SELECT database_privs_are(
32
'postgres', 'postgres', ARRAY['CONNECT', 'TEMPORARY', 'CREATE']
43
);
@@ -28,3 +27,7 @@ SELECT schema_privs_are('extensions', 'postgres', array['CREATE', 'USAGE']);
2827
SELECT schema_privs_are('extensions', 'anon', array['USAGE']);
2928
SELECT schema_privs_are('extensions', 'authenticated', array['USAGE']);
3029
SELECT schema_privs_are('extensions', 'service_role', array['USAGE']);
30+
31+
-- Role memberships
32+
SELECT is_member_of('pg_read_all_data', 'postgres');
33+
SELECT is_member_of('pg_signal_backend', 'postgres');

migrations/tests/test.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BEGIN;
55

66
CREATE EXTENSION IF NOT EXISTS pgtap;
77

8-
SELECT plan(34);
8+
SELECT no_plan();
99

1010
\ir fixtures.sql
1111
\ir database/test.sql

0 commit comments

Comments
 (0)