File: pgq_perms.sql

package info (click to toggle)
pgq 3.2.6-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 836 kB
  • sloc: sql: 3,412; ansic: 1,990; python: 302; makefile: 89; sh: 2
file content (41 lines) | stat: -rw-r--r-- 1,146 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
\set ECHO none
\set VERBOSITY 'terse'
set client_min_messages = 'warning';

-- drop public perms
\i structure/newgrants_pgq.sql

-- select proname, proacl from pg_proc p, pg_namespace n where n.nspname = 'pgq' and p.pronamespace = n.oid;

\set ECHO all

drop role if exists pgq_test_producer;
drop role if exists pgq_test_consumer;
drop role if exists pgq_test_admin;

create role pgq_test_consumer with login in role pgq_reader;
create role pgq_test_producer with login in role pgq_writer;
create role pgq_test_admin with login in role pgq_admin;


\c - pgq_test_admin

select * from pgq.create_queue('pqueue'); -- ok

\c - pgq_test_producer

select * from pgq.create_queue('pqueue'); -- fail

select * from pgq.insert_event('pqueue', 'test', 'data'); -- ok

select * from pgq.register_consumer('pqueue', 'prod'); -- fail

\c - pgq_test_consumer

select * from pgq.create_queue('pqueue'); -- fail
select * from pgq.insert_event('pqueue', 'test', 'data'); -- fail
select * from pgq.register_consumer('pqueue', 'cons'); -- ok
select * from pgq.next_batch('pqueue', 'cons'); -- ok

\c - pgq_test_admin
select * from pgq.drop_queue('pqueue', true);