@@ -24,24 +24,31 @@ CREATE ROLE regress_noiseword SYSID 12345;
24
24
NOTICE: SYSID can no longer be specified
25
25
-- fail, cannot grant membership in superuser role
26
26
CREATE ROLE regress_nosuch_super IN ROLE regress_role_super;
27
- ERROR: must be superuser to alter superusers
27
+ ERROR: permission denied to grant role "regress_role_super"
28
+ DETAIL: Only roles with the SUPERUSER attribute may grant roles with the SUPERUSER attribute.
28
29
-- fail, database owner cannot have members
29
30
CREATE ROLE regress_nosuch_dbowner IN ROLE pg_database_owner;
30
31
ERROR: role "pg_database_owner" cannot have explicit members
31
32
-- ok, can grant other users into a role
32
33
CREATE ROLE regress_inroles ROLE
33
34
regress_role_super, regress_createdb, regress_createrole, regress_login,
34
35
regress_inherit, regress_connection_limit, regress_encrypted_password, regress_password_null;
36
+ ERROR: permission denied to grant role "regress_inroles"
37
+ DETAIL: Only roles with the ADMIN option on role "regress_inroles" may grant this role.
35
38
-- fail, cannot grant a role into itself
36
39
CREATE ROLE regress_nosuch_recursive ROLE regress_nosuch_recursive;
37
- ERROR: role "regress_nosuch_recursive" is a member of role "regress_nosuch_recursive"
40
+ ERROR: permission denied to grant role "regress_nosuch_recursive"
41
+ DETAIL: Only roles with the ADMIN option on role "regress_nosuch_recursive" may grant this role.
38
42
-- ok, can grant other users into a role with admin option
39
43
CREATE ROLE regress_adminroles ADMIN
40
44
regress_role_super, regress_createdb, regress_createrole, regress_login,
41
45
regress_inherit, regress_connection_limit, regress_encrypted_password, regress_password_null;
46
+ ERROR: permission denied to grant role "regress_adminroles"
47
+ DETAIL: Only roles with the ADMIN option on role "regress_adminroles" may grant this role.
42
48
-- fail, cannot grant a role into itself with admin option
43
49
CREATE ROLE regress_nosuch_admin_recursive ADMIN regress_nosuch_admin_recursive;
44
- ERROR: role "regress_nosuch_admin_recursive" is a member of role "regress_nosuch_admin_recursive"
50
+ ERROR: permission denied to grant role "regress_nosuch_admin_recursive"
51
+ DETAIL: Only roles with the ADMIN option on role "regress_nosuch_admin_recursive" may grant this role.
45
52
-- fail, regress_createrole does not have CREATEDB privilege
46
53
SET SESSION AUTHORIZATION regress_createrole;
47
54
CREATE DATABASE regress_nosuch_db;
@@ -75,15 +82,35 @@ REASSIGN OWNED BY regress_tenant TO regress_createrole;
75
82
ERROR: permission denied to reassign objects
76
83
-- ok, having CREATEROLE is enough to create roles in privileged roles
77
84
CREATE ROLE regress_read_all_data IN ROLE pg_read_all_data;
85
+ ERROR: permission denied to grant role "pg_read_all_data"
86
+ DETAIL: Only roles with the ADMIN option on role "pg_read_all_data" may grant this role.
78
87
CREATE ROLE regress_write_all_data IN ROLE pg_write_all_data;
88
+ ERROR: permission denied to grant role "pg_write_all_data"
89
+ DETAIL: Only roles with the ADMIN option on role "pg_write_all_data" may grant this role.
79
90
CREATE ROLE regress_monitor IN ROLE pg_monitor;
91
+ ERROR: permission denied to grant role "pg_monitor"
92
+ DETAIL: Only roles with the ADMIN option on role "pg_monitor" may grant this role.
80
93
CREATE ROLE regress_read_all_settings IN ROLE pg_read_all_settings;
94
+ ERROR: permission denied to grant role "pg_read_all_settings"
95
+ DETAIL: Only roles with the ADMIN option on role "pg_read_all_settings" may grant this role.
81
96
CREATE ROLE regress_read_all_stats IN ROLE pg_read_all_stats;
97
+ ERROR: permission denied to grant role "pg_read_all_stats"
98
+ DETAIL: Only roles with the ADMIN option on role "pg_read_all_stats" may grant this role.
82
99
CREATE ROLE regress_stat_scan_tables IN ROLE pg_stat_scan_tables;
100
+ ERROR: permission denied to grant role "pg_stat_scan_tables"
101
+ DETAIL: Only roles with the ADMIN option on role "pg_stat_scan_tables" may grant this role.
83
102
CREATE ROLE regress_read_server_files IN ROLE pg_read_server_files;
103
+ ERROR: permission denied to grant role "pg_read_server_files"
104
+ DETAIL: Only roles with the ADMIN option on role "pg_read_server_files" may grant this role.
84
105
CREATE ROLE regress_write_server_files IN ROLE pg_write_server_files;
106
+ ERROR: permission denied to grant role "pg_write_server_files"
107
+ DETAIL: Only roles with the ADMIN option on role "pg_write_server_files" may grant this role.
85
108
CREATE ROLE regress_execute_server_program IN ROLE pg_execute_server_program;
109
+ ERROR: permission denied to grant role "pg_execute_server_program"
110
+ DETAIL: Only roles with the ADMIN option on role "pg_execute_server_program" may grant this role.
86
111
CREATE ROLE regress_signal_backend IN ROLE pg_signal_backend;
112
+ ERROR: permission denied to grant role "pg_signal_backend"
113
+ DETAIL: Only roles with the ADMIN option on role "pg_signal_backend" may grant this role.
87
114
-- fail, creation of these roles failed above so they do not now exist
88
115
SET SESSION AUTHORIZATION regress_role_admin;
89
116
DROP ROLE regress_nosuch_superuser;
@@ -113,18 +140,30 @@ DROP ROLE regress_encrypted_password;
113
140
DROP ROLE regress_password_null;
114
141
DROP ROLE regress_noiseword;
115
142
DROP ROLE regress_inroles;
143
+ ERROR: role "regress_inroles" does not exist
116
144
DROP ROLE regress_adminroles;
145
+ ERROR: role "regress_adminroles" does not exist
117
146
DROP ROLE regress_rolecreator;
118
147
DROP ROLE regress_read_all_data;
148
+ ERROR: role "regress_read_all_data" does not exist
119
149
DROP ROLE regress_write_all_data;
150
+ ERROR: role "regress_write_all_data" does not exist
120
151
DROP ROLE regress_monitor;
152
+ ERROR: role "regress_monitor" does not exist
121
153
DROP ROLE regress_read_all_settings;
154
+ ERROR: role "regress_read_all_settings" does not exist
122
155
DROP ROLE regress_read_all_stats;
156
+ ERROR: role "regress_read_all_stats" does not exist
123
157
DROP ROLE regress_stat_scan_tables;
158
+ ERROR: role "regress_stat_scan_tables" does not exist
124
159
DROP ROLE regress_read_server_files;
160
+ ERROR: role "regress_read_server_files" does not exist
125
161
DROP ROLE regress_write_server_files;
162
+ ERROR: role "regress_write_server_files" does not exist
126
163
DROP ROLE regress_execute_server_program;
164
+ ERROR: role "regress_execute_server_program" does not exist
127
165
DROP ROLE regress_signal_backend;
166
+ ERROR: role "regress_signal_backend" does not exist
128
167
-- fail, role still owns database objects
129
168
DROP ROLE regress_tenant;
130
169
ERROR: role "regress_tenant" cannot be dropped because some objects depend on it
0 commit comments