1+ -- Some predefined roles don't exist in earlier versions of Postgres, so we
2+ -- exclude them in this test file. They're tested in version-specific test files
3+ -- (z_<ver>_roles.sql).
4+ --
5+ -- Currently those roles are:
6+ -- pg_create_subscription, pg_maintain, pg_use_reserved_connections
17-- all roles and attributes
28select
39 rolname,
1117 rolbypassrls ,
1218 rolvaliduntil
1319from pg_roles r
14- -- TODO: this exclusion is to maintain compat with pg17, we should cover it
1520where rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
1621order by rolname;
1722 rolname | rolcreaterole | rolcanlogin | rolsuper | rolinherit | rolcreatedb | rolreplication | rolconnlimit | rolbypassrls | rolvaliduntil
5156 rolname,
5257 rolconfig
5358from pg_roles r
54- -- TODO: this exclusion is to maintain compat with pg17, we should cover it
5559where rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
5660order by rolname;
5761 rolname | rolconfig
@@ -98,53 +102,31 @@ left join
98102 pg_auth_members m on r.oid = m.member
99103left join
100104 pg_roles g on m.roleid = g.oid
101- -- TODO: this exclusion is to maintain compat with pg17, we should cover it
102105where r.rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
106+ and g.rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
103107order by
104108 r.rolname, g.rolname;
105- member | member_of (can become) | admin_option
106- ----------------------------+------------------------+--------------
107- anon | |
108- authenticated | |
109- authenticator | anon | f
110- authenticator | authenticated | f
111- authenticator | service_role | f
112- dashboard_user | |
113- pg_checkpoint | |
114- pg_database_owner | |
115- pg_execute_server_program | |
116- pg_monitor | pg_read_all_settings | f
117- pg_monitor | pg_read_all_stats | f
118- pg_monitor | pg_stat_scan_tables | f
119- pg_read_all_data | |
120- pg_read_all_settings | |
121- pg_read_all_stats | |
122- pg_read_server_files | |
123- pg_signal_backend | |
124- pg_stat_scan_tables | |
125- pg_write_all_data | |
126- pg_write_server_files | |
127- pgbouncer | |
128- pgsodium_keyholder | pgsodium_keyiduser | f
129- pgsodium_keyiduser | |
130- pgsodium_keymaker | pgsodium_keyholder | f
131- pgsodium_keymaker | pgsodium_keyiduser | f
132- pgtle_admin | |
133- postgres | anon | f
134- postgres | authenticated | f
135- postgres | pg_monitor | f
136- postgres | pg_read_all_data | f
137- postgres | pg_signal_backend | f
138- postgres | pgtle_admin | f
139- postgres | service_role | f
140- service_role | |
141- supabase_admin | |
142- supabase_auth_admin | |
143- supabase_functions_admin | |
144- supabase_read_only_user | pg_read_all_data | f
145- supabase_replication_admin | |
146- supabase_storage_admin | authenticator | f
147- (40 rows)
109+ member | member_of (can become) | admin_option
110+ -------------------------+------------------------+--------------
111+ authenticator | anon | f
112+ authenticator | authenticated | f
113+ authenticator | service_role | f
114+ pg_monitor | pg_read_all_settings | f
115+ pg_monitor | pg_read_all_stats | f
116+ pg_monitor | pg_stat_scan_tables | f
117+ pgsodium_keyholder | pgsodium_keyiduser | f
118+ pgsodium_keymaker | pgsodium_keyholder | f
119+ pgsodium_keymaker | pgsodium_keyiduser | f
120+ postgres | anon | f
121+ postgres | authenticated | f
122+ postgres | pg_monitor | f
123+ postgres | pg_read_all_data | f
124+ postgres | pg_signal_backend | f
125+ postgres | pgtle_admin | f
126+ postgres | service_role | f
127+ supabase_read_only_user | pg_read_all_data | f
128+ supabase_storage_admin | authenticator | f
129+ (18 rows)
148130
149131-- Check all privileges of the roles on the schemas
150132select schema_name, privilege_type, grantee, default_for
@@ -164,7 +146,8 @@ from (
164146 join
165147 pg_roles r on a.grantee = r.oid
166148 where
167- a.privilege_type != 'MAINTAIN' -- TODO: this is to maintain compat with pg17, we should cover it
149+ -- PG17+, handled in version-specific test files
150+ a.privilege_type != 'MAINTAIN'
168151 union all
169152 -- explicit grant usage and create on the schemas
170153 select
0 commit comments