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
1
7
-- all roles and attributes
2
8
select
3
9
rolname,
11
17
rolbypassrls ,
12
18
rolvaliduntil
13
19
from pg_roles r
14
- -- TODO: this exclusion is to maintain compat with pg17, we should cover it
15
20
where rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
16
21
order by rolname;
17
22
rolname | rolcreaterole | rolcanlogin | rolsuper | rolinherit | rolcreatedb | rolreplication | rolconnlimit | rolbypassrls | rolvaliduntil
51
56
rolname,
52
57
rolconfig
53
58
from pg_roles r
54
- -- TODO: this exclusion is to maintain compat with pg17, we should cover it
55
59
where rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
56
60
order by rolname;
57
61
rolname | rolconfig
@@ -98,53 +102,31 @@ left join
98
102
pg_auth_members m on r.oid = m.member
99
103
left join
100
104
pg_roles g on m.roleid = g.oid
101
- -- TODO: this exclusion is to maintain compat with pg17, we should cover it
102
105
where 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')
103
107
order by
104
108
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)
148
130
149
131
-- Check all privileges of the roles on the schemas
150
132
select schema_name, privilege_type, grantee, default_for
@@ -164,7 +146,8 @@ from (
164
146
join
165
147
pg_roles r on a.grantee = r.oid
166
148
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'
168
151
union all
169
152
-- explicit grant usage and create on the schemas
170
153
select
0 commit comments