|
1 | 1 | CREATE ROLE regress_mdb_superuser_user1; |
2 | 2 | CREATE ROLE regress_mdb_superuser_user2; |
3 | 3 | CREATE ROLE regress_mdb_superuser_user3; |
| 4 | +CREATE ROLE regress_mdb_su_role_o1; |
| 5 | +CREATE ROLE regress_mdb_su_role_o2; |
| 6 | +GRANT mdb_superuser TO regress_mdb_su_role_o1; |
4 | 7 | GRANT mdb_admin TO mdb_superuser; |
5 | 8 | CREATE ROLE regress_superuser WITH SUPERUSER; |
6 | 9 | GRANT mdb_superuser TO regress_mdb_superuser_user1; |
7 | 10 | GRANT CREATE ON DATABASE regression TO regress_mdb_superuser_user2; |
8 | 11 | GRANT CREATE ON DATABASE regression TO regress_mdb_superuser_user3; |
| 12 | +GRANT CREATE ON DATABASE regression TO regress_mdb_su_role_o2; |
9 | 13 | SET ROLE regress_mdb_superuser_user2; |
10 | 14 | CREATE FUNCTION regress_mdb_superuser_add(integer, integer) RETURNS integer |
11 | 15 | AS 'SELECT $1 + $2;' |
@@ -85,13 +89,30 @@ ERROR: permission denied for schema regtest |
85 | 89 | SET ROLE regress_mdb_superuser_user1; |
86 | 90 | GRANT ALL ON TABLE regtest.regtest TO regress_mdb_superuser_user1; |
87 | 91 | ALTER TABLE regtest.regtest OWNER TO regress_mdb_superuser_user1; |
| 92 | +-- Check grantor |
| 93 | +SET ROLE regress_mdb_su_role_o2; |
| 94 | +CREATE TABLE public.role_o2_t(); |
| 95 | +SET ROLE mdb_superuser; |
| 96 | +GRANT SELECT ON public.role_o2_t TO regress_mdb_su_role_o1; |
| 97 | +SELECT |
| 98 | + grantor |
| 99 | +from information_schema.role_table_grants |
| 100 | +where grantee='regress_mdb_su_role_o1' AND table_name = 'role_o2_t'; |
| 101 | + grantor |
| 102 | +------------------------ |
| 103 | + regress_mdb_su_role_o2 |
| 104 | +(1 row) |
| 105 | + |
88 | 106 | \c regression |
89 | 107 | DROP DATABASE regress_check_owner; |
90 | 108 | -- end tests |
91 | 109 | RESET SESSION AUTHORIZATION; |
92 | 110 | -- |
93 | 111 | REVOKE CREATE ON DATABASE regression FROM regress_mdb_superuser_user2; |
94 | 112 | REVOKE CREATE ON DATABASE regression FROM regress_mdb_superuser_user3; |
| 113 | +REVOKE CREATE ON DATABASE regression FROM regress_mdb_su_role_o2; |
| 114 | +DROP ROLE regress_mdb_su_role_o1; |
| 115 | +DROP ROLE regress_mdb_su_role_o2; |
95 | 116 | DROP VIEW regress_mdb_superuser_view; |
96 | 117 | DROP FUNCTION regress_mdb_superuser_add; |
97 | 118 | DROP TABLE regress_mdb_superuser_schema.regress_mdb_superuser_table; |
|
0 commit comments