Skip to content

Commit 6ac8fca

Browse files
committed
test: postgres storage privs
1 parent e404b56 commit 6ac8fca

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

nix/tests/expected/storage.out

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,24 @@ select * from storage.migrations ;
206206
----+------+------+-------------
207207
(0 rows)
208208

209+
-- postgres can grant storage privileges to custom roles
210+
create role r;
211+
grant r to postgres with admin option;
212+
set role r;
213+
select * from storage.buckets;
214+
ERROR: permission denied for schema storage
215+
LINE 1: select * from storage.buckets;
216+
^
217+
set role postgres;
218+
grant usage on schema storage to r;
219+
grant select on storage.buckets to r;
220+
set role r;
221+
select * from storage.buckets;
222+
id | name | owner | created_at | updated_at
223+
----+------+-------+------------+------------
224+
(0 rows)
225+
226+
set role postgres;
227+
drop owned by r cascade;
228+
drop role r;
229+
reset role;

nix/tests/sql/storage.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,22 @@ order by
9595

9696
-- storage service migrations
9797
select * from storage.migrations ;
98+
99+
-- postgres can grant storage privileges to custom roles
100+
create role r;
101+
grant r to postgres with admin option;
102+
103+
set role r;
104+
select * from storage.buckets;
105+
106+
set role postgres;
107+
grant usage on schema storage to r;
108+
grant select on storage.buckets to r;
109+
110+
set role r;
111+
select * from storage.buckets;
112+
113+
set role postgres;
114+
drop owned by r cascade;
115+
drop role r;
116+
reset role;

0 commit comments

Comments
 (0)