2 -- Test access privileges
4 -- Clean up in case a prior regression run failed
5 -- Suppress NOTICE messages when users/groups don't exist
6 SET client_min_messages TO 'error';
7 DROP ROLE IF EXISTS regressgroup1;
8 DROP ROLE IF EXISTS regressgroup2;
9 DROP ROLE IF EXISTS regressuser1;
10 DROP ROLE IF EXISTS regressuser2;
11 DROP ROLE IF EXISTS regressuser3;
12 DROP ROLE IF EXISTS regressuser4;
13 DROP ROLE IF EXISTS regressuser5;
14 RESET client_min_messages;
15 -- test proper begins here
16 CREATE USER regressuser1;
17 CREATE USER regressuser2;
18 CREATE USER regressuser3;
19 CREATE USER regressuser4;
20 CREATE USER regressuser5;
21 CREATE USER regressuser5; -- duplicate
22 ERROR: role "regressuser5" already exists
23 CREATE GROUP regressgroup1;
24 CREATE GROUP regressgroup2 WITH USER regressuser1, regressuser2;
25 ALTER GROUP regressgroup1 ADD USER regressuser4;
26 ALTER GROUP regressgroup2 ADD USER regressuser2; -- duplicate
27 NOTICE: role "regressuser2" is already a member of role "regressgroup2"
28 ALTER GROUP regressgroup2 DROP USER regressuser2;
29 ALTER GROUP regressgroup2 ADD USER regressuser4;
30 -- test owner privileges
31 SET SESSION AUTHORIZATION regressuser1;
32 SELECT session_user, current_user;
33 session_user | current_user
34 --------------+--------------
35 regressuser1 | regressuser1
38 CREATE TABLE atest1 ( a int, b text );
44 INSERT INTO atest1 VALUES (1, 'one');
46 UPDATE atest1 SET a = 1 WHERE b = 'blech';
49 LOCK atest1 IN ACCESS EXCLUSIVE MODE;
51 REVOKE ALL ON atest1 FROM PUBLIC;
57 GRANT ALL ON atest1 TO regressuser2;
58 GRANT SELECT ON atest1 TO regressuser3, regressuser4;
64 CREATE TABLE atest2 (col1 varchar(10), col2 boolean);
65 GRANT SELECT ON atest2 TO regressuser2;
66 GRANT UPDATE ON atest2 TO regressuser3;
67 GRANT INSERT ON atest2 TO regressuser4;
68 GRANT TRUNCATE ON atest2 TO regressuser5;
69 SET SESSION AUTHORIZATION regressuser2;
70 SELECT session_user, current_user;
71 session_user | current_user
72 --------------+--------------
73 regressuser2 | regressuser2
76 -- try various combinations of queries on atest1 and atest2
77 SELECT * FROM atest1; -- ok
82 SELECT * FROM atest2; -- ok
87 INSERT INTO atest1 VALUES (2, 'two'); -- ok
88 INSERT INTO atest2 VALUES ('foo', true); -- fail
89 ERROR: permission denied for relation atest2
90 INSERT INTO atest1 SELECT 1, b FROM atest1; -- ok
91 UPDATE atest1 SET a = 1 WHERE a = 2; -- ok
92 UPDATE atest2 SET col2 = NOT col2; -- fail
93 ERROR: permission denied for relation atest2
94 SELECT * FROM atest1 FOR UPDATE; -- ok
101 SELECT * FROM atest2 FOR UPDATE; -- fail
102 ERROR: permission denied for relation atest2
103 DELETE FROM atest2; -- fail
104 ERROR: permission denied for relation atest2
105 TRUNCATE atest2; -- fail
106 ERROR: permission denied for relation atest2
108 LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- fail
109 ERROR: permission denied for relation atest2
111 COPY atest2 FROM stdin; -- fail
112 ERROR: permission denied for relation atest2
113 GRANT ALL ON atest1 TO PUBLIC; -- fail
114 WARNING: no privileges were granted for "atest1"
115 -- checks in subquery, both ok
116 SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) );
121 SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) );
126 SET SESSION AUTHORIZATION regressuser3;
127 SELECT session_user, current_user;
128 session_user | current_user
129 --------------+--------------
130 regressuser3 | regressuser3
133 SELECT * FROM atest1; -- ok
140 SELECT * FROM atest2; -- fail
141 ERROR: permission denied for relation atest2
142 INSERT INTO atest1 VALUES (2, 'two'); -- fail
143 ERROR: permission denied for relation atest1
144 INSERT INTO atest2 VALUES ('foo', true); -- fail
145 ERROR: permission denied for relation atest2
146 INSERT INTO atest1 SELECT 1, b FROM atest1; -- fail
147 ERROR: permission denied for relation atest1
148 UPDATE atest1 SET a = 1 WHERE a = 2; -- fail
149 ERROR: permission denied for relation atest1
150 UPDATE atest2 SET col2 = NULL; -- ok
151 UPDATE atest2 SET col2 = NOT col2; -- fails; requires SELECT on atest2
152 ERROR: permission denied for relation atest2
153 UPDATE atest2 SET col2 = true FROM atest1 WHERE atest1.a = 5; -- ok
154 SELECT * FROM atest1 FOR UPDATE; -- fail
155 ERROR: permission denied for relation atest1
156 SELECT * FROM atest2 FOR UPDATE; -- fail
157 ERROR: permission denied for relation atest2
158 DELETE FROM atest2; -- fail
159 ERROR: permission denied for relation atest2
160 TRUNCATE atest2; -- fail
161 ERROR: permission denied for relation atest2
163 LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- ok
165 COPY atest2 FROM stdin; -- fail
166 ERROR: permission denied for relation atest2
167 -- checks in subquery, both fail
168 SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) );
169 ERROR: permission denied for relation atest2
170 SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) );
171 ERROR: permission denied for relation atest2
172 SET SESSION AUTHORIZATION regressuser4;
173 COPY atest2 FROM stdin; -- ok
174 SELECT * FROM atest1; -- ok
182 SET SESSION AUTHORIZATION regressuser3;
183 CREATE TABLE atest3 (one int, two int, three int);
184 GRANT DELETE ON atest3 TO GROUP regressgroup2;
185 SET SESSION AUTHORIZATION regressuser1;
186 SELECT * FROM atest3; -- fail
187 ERROR: permission denied for relation atest3
188 DELETE FROM atest3; -- ok
190 SET SESSION AUTHORIZATION regressuser3;
191 CREATE VIEW atestv1 AS SELECT * FROM atest1; -- ok
192 /* The next *should* fail, but it's not implemented that way yet. */
193 CREATE VIEW atestv2 AS SELECT * FROM atest2;
194 CREATE VIEW atestv3 AS SELECT * FROM atest3; -- ok
195 SELECT * FROM atestv1; -- ok
202 SELECT * FROM atestv2; -- fail
203 ERROR: permission denied for relation atest2
204 GRANT SELECT ON atestv1, atestv3 TO regressuser4;
205 GRANT SELECT ON atestv2 TO regressuser2;
206 SET SESSION AUTHORIZATION regressuser4;
207 SELECT * FROM atestv1; -- ok
214 SELECT * FROM atestv2; -- fail
215 ERROR: permission denied for relation atestv2
216 SELECT * FROM atestv3; -- ok
221 CREATE VIEW atestv4 AS SELECT * FROM atestv3; -- nested view
222 SELECT * FROM atestv4; -- ok
227 GRANT SELECT ON atestv4 TO regressuser2;
228 SET SESSION AUTHORIZATION regressuser2;
229 -- Two complex cases:
230 SELECT * FROM atestv3; -- fail
231 ERROR: permission denied for relation atestv3
232 SELECT * FROM atestv4; -- ok (even though regressuser2 cannot access underlying atestv3)
237 SELECT * FROM atest2; -- ok
243 SELECT * FROM atestv2; -- fail (even though regressuser2 can access underlying atest2)
244 ERROR: permission denied for relation atest2
245 -- Test column level permissions
246 SET SESSION AUTHORIZATION regressuser1;
247 CREATE TABLE atest5 (one int, two int, three int);
248 CREATE TABLE atest6 (one int, two int, blue int);
249 GRANT SELECT (one), INSERT (two), UPDATE (three) ON atest5 TO regressuser4;
250 GRANT ALL (one) ON atest5 TO regressuser3;
251 INSERT INTO atest5 VALUES (1,2,3);
252 SET SESSION AUTHORIZATION regressuser4;
253 SELECT * FROM atest5; -- fail
254 ERROR: permission denied for relation atest5
255 SELECT one FROM atest5; -- ok
261 COPY atest5 (one) TO stdout; -- ok
263 SELECT two FROM atest5; -- fail
264 ERROR: permission denied for relation atest5
265 COPY atest5 (two) TO stdout; -- fail
266 ERROR: permission denied for relation atest5
267 SELECT atest5 FROM atest5; -- fail
268 ERROR: permission denied for relation atest5
269 COPY atest5 (one,two) TO stdout; -- fail
270 ERROR: permission denied for relation atest5
271 SELECT 1 FROM atest5; -- ok
277 SELECT 1 FROM atest5 a JOIN atest5 b USING (one); -- ok
283 SELECT 1 FROM atest5 a JOIN atest5 b USING (two); -- fail
284 ERROR: permission denied for relation atest5
285 SELECT 1 FROM atest5 a NATURAL JOIN atest5 b; -- fail
286 ERROR: permission denied for relation atest5
287 SELECT (j.*) IS NULL FROM (atest5 a JOIN atest5 b USING (one)) j; -- fail
288 ERROR: permission denied for relation atest5
289 SELECT 1 FROM atest5 WHERE two = 2; -- fail
290 ERROR: permission denied for relation atest5
291 SELECT * FROM atest1, atest5; -- fail
292 ERROR: permission denied for relation atest5
293 SELECT atest1.* FROM atest1, atest5; -- ok
300 SELECT atest1.*,atest5.one FROM atest1, atest5; -- ok
307 SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.two); -- fail
308 ERROR: permission denied for relation atest5
309 SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.one); -- ok
316 SELECT one, two FROM atest5; -- fail
317 ERROR: permission denied for relation atest5
318 SET SESSION AUTHORIZATION regressuser1;
319 GRANT SELECT (one,two) ON atest6 TO regressuser4;
320 SET SESSION AUTHORIZATION regressuser4;
321 SELECT one, two FROM atest5 NATURAL JOIN atest6; -- fail still
322 ERROR: permission denied for relation atest5
323 SET SESSION AUTHORIZATION regressuser1;
324 GRANT SELECT (two) ON atest5 TO regressuser4;
325 SET SESSION AUTHORIZATION regressuser4;
326 SELECT one, two FROM atest5 NATURAL JOIN atest6; -- ok now
331 -- test column-level privileges for INSERT and UPDATE
332 INSERT INTO atest5 (two) VALUES (3); -- ok
333 COPY atest5 FROM stdin; -- fail
334 ERROR: permission denied for relation atest5
335 COPY atest5 (two) FROM stdin; -- ok
336 INSERT INTO atest5 (three) VALUES (4); -- fail
337 ERROR: permission denied for relation atest5
338 INSERT INTO atest5 VALUES (5,5,5); -- fail
339 ERROR: permission denied for relation atest5
340 UPDATE atest5 SET three = 10; -- ok
341 UPDATE atest5 SET one = 8; -- fail
342 ERROR: permission denied for relation atest5
343 UPDATE atest5 SET three = 5, one = 2; -- fail
344 ERROR: permission denied for relation atest5
345 SET SESSION AUTHORIZATION regressuser1;
346 REVOKE ALL (one) ON atest5 FROM regressuser4;
347 GRANT SELECT (one,two,blue) ON atest6 TO regressuser4;
348 SET SESSION AUTHORIZATION regressuser4;
349 SELECT one FROM atest5; -- fail
350 ERROR: permission denied for relation atest5
351 UPDATE atest5 SET one = 1; -- fail
352 ERROR: permission denied for relation atest5
353 SELECT atest6 FROM atest6; -- ok
358 COPY atest6 TO stdout; -- ok
359 -- test column-level privileges when involved with DELETE
360 SET SESSION AUTHORIZATION regressuser1;
361 ALTER TABLE atest6 ADD COLUMN three integer;
362 GRANT DELETE ON atest5 TO regressuser3;
363 GRANT SELECT (two) ON atest5 TO regressuser3;
364 REVOKE ALL (one) ON atest5 FROM regressuser3;
365 GRANT SELECT (one) ON atest5 TO regressuser4;
366 SET SESSION AUTHORIZATION regressuser4;
367 SELECT atest6 FROM atest6; -- fail
368 ERROR: permission denied for relation atest6
369 SELECT one FROM atest5 NATURAL JOIN atest6; -- fail
370 ERROR: permission denied for relation atest5
371 SET SESSION AUTHORIZATION regressuser1;
372 ALTER TABLE atest6 DROP COLUMN three;
373 SET SESSION AUTHORIZATION regressuser4;
374 SELECT atest6 FROM atest6; -- ok
379 SELECT one FROM atest5 NATURAL JOIN atest6; -- ok
384 SET SESSION AUTHORIZATION regressuser1;
385 ALTER TABLE atest6 DROP COLUMN two;
386 REVOKE SELECT (one,blue) ON atest6 FROM regressuser4;
387 SET SESSION AUTHORIZATION regressuser4;
388 SELECT * FROM atest6; -- fail
389 ERROR: permission denied for relation atest6
390 SELECT 1 FROM atest6; -- fail
391 ERROR: permission denied for relation atest6
392 SET SESSION AUTHORIZATION regressuser3;
393 DELETE FROM atest5 WHERE one = 1; -- fail
394 ERROR: permission denied for relation atest5
395 DELETE FROM atest5 WHERE two = 2; -- ok
396 -- check inheritance cases
397 SET SESSION AUTHORIZATION regressuser1;
398 CREATE TABLE atestp1 (f1 int, f2 int) WITH OIDS;
399 CREATE TABLE atestp2 (fx int, fy int) WITH OIDS;
400 CREATE TABLE atestc (fz int) INHERITS (atestp1, atestp2);
401 GRANT SELECT(fx,fy,oid) ON atestp2 TO regressuser2;
402 GRANT SELECT(fx) ON atestc TO regressuser2;
403 SET SESSION AUTHORIZATION regressuser2;
404 SELECT fx FROM atestp2; -- ok
409 SELECT fy FROM atestp2; -- fail, no privilege on atestc.fy
410 ERROR: permission denied for relation atestc
411 SELECT atestp2 FROM atestp2; -- fail, no privilege on atestc.fy
412 ERROR: permission denied for relation atestc
413 SELECT oid FROM atestp2; -- fail, no privilege on atestc.oid
414 ERROR: permission denied for relation atestc
415 SET SESSION AUTHORIZATION regressuser1;
416 GRANT SELECT(fy,oid) ON atestc TO regressuser2;
417 SET SESSION AUTHORIZATION regressuser2;
418 SELECT fx FROM atestp2; -- still ok
423 SELECT fy FROM atestp2; -- ok
428 SELECT atestp2 FROM atestp2; -- ok
433 SELECT oid FROM atestp2; -- ok
438 -- privileges on functions, languages
439 -- switch to superuser
441 REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC;
442 GRANT USAGE ON LANGUAGE sql TO regressuser1; -- ok
443 GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail
444 ERROR: language "c" is not trusted
445 HINT: Only superusers can use untrusted languages.
446 SET SESSION AUTHORIZATION regressuser1;
447 GRANT USAGE ON LANGUAGE sql TO regressuser2; -- fail
448 WARNING: no privileges were granted for "sql"
449 CREATE FUNCTION testfunc1(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql;
450 CREATE FUNCTION testfunc2(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql;
451 REVOKE ALL ON FUNCTION testfunc1(int), testfunc2(int) FROM PUBLIC;
452 GRANT EXECUTE ON FUNCTION testfunc1(int), testfunc2(int) TO regressuser2;
453 GRANT USAGE ON FUNCTION testfunc1(int) TO regressuser3; -- semantic error
454 ERROR: invalid privilege type USAGE for function
455 GRANT ALL PRIVILEGES ON FUNCTION testfunc1(int) TO regressuser4;
456 GRANT ALL PRIVILEGES ON FUNCTION testfunc_nosuch(int) TO regressuser4;
457 ERROR: function testfunc_nosuch(integer) does not exist
458 CREATE FUNCTION testfunc4(boolean) RETURNS text
459 AS 'select col1 from atest2 where col2 = $1;'
460 LANGUAGE sql SECURITY DEFINER;
461 GRANT EXECUTE ON FUNCTION testfunc4(boolean) TO regressuser3;
462 SET SESSION AUTHORIZATION regressuser2;
463 SELECT testfunc1(5), testfunc2(5); -- ok
464 testfunc1 | testfunc2
465 -----------+-----------
469 CREATE FUNCTION testfunc3(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql; -- fail
470 ERROR: permission denied for language sql
471 SET SESSION AUTHORIZATION regressuser3;
472 SELECT testfunc1(5); -- fail
473 ERROR: permission denied for function testfunc1
474 SELECT col1 FROM atest2 WHERE col2 = true; -- fail
475 ERROR: permission denied for relation atest2
476 SELECT testfunc4(true); -- ok
482 SET SESSION AUTHORIZATION regressuser4;
483 SELECT testfunc1(5); -- ok
489 DROP FUNCTION testfunc1(int); -- fail
490 ERROR: must be owner of function testfunc1
492 DROP FUNCTION testfunc1(int); -- ok
494 GRANT ALL PRIVILEGES ON LANGUAGE sql TO PUBLIC;
496 SET SESSION AUTHORIZATION regressuser5;
497 TRUNCATE atest2; -- ok
498 TRUNCATE atest3; -- fail
499 ERROR: permission denied for relation atest3
500 -- has_table_privilege function
502 select has_table_privilege(NULL,'pg_authid','select');
504 ---------------------
508 select has_table_privilege('pg_shad','select');
509 ERROR: relation "pg_shad" does not exist
510 select has_table_privilege('nosuchuser','pg_authid','select');
511 ERROR: role "nosuchuser" does not exist
512 select has_table_privilege('pg_authid','sel');
513 ERROR: unrecognized privilege type: "sel"
514 select has_table_privilege(-999999,'pg_authid','update');
515 ERROR: role with OID 4293967297 does not exist
516 select has_table_privilege(1,'select');
518 ---------------------
524 select has_table_privilege(current_user,'pg_authid','select');
526 ---------------------
530 select has_table_privilege(current_user,'pg_authid','insert');
532 ---------------------
536 select has_table_privilege(t2.oid,'pg_authid','update')
537 from (select oid from pg_roles where rolname = current_user) as t2;
539 ---------------------
543 select has_table_privilege(t2.oid,'pg_authid','delete')
544 from (select oid from pg_roles where rolname = current_user) as t2;
546 ---------------------
550 -- 'rule' privilege no longer exists, but for backwards compatibility
551 -- has_table_privilege still recognizes the keyword and says FALSE
552 select has_table_privilege(current_user,t1.oid,'rule')
553 from (select oid from pg_class where relname = 'pg_authid') as t1;
555 ---------------------
559 select has_table_privilege(current_user,t1.oid,'references')
560 from (select oid from pg_class where relname = 'pg_authid') as t1;
562 ---------------------
566 select has_table_privilege(t2.oid,t1.oid,'select')
567 from (select oid from pg_class where relname = 'pg_authid') as t1,
568 (select oid from pg_roles where rolname = current_user) as t2;
570 ---------------------
574 select has_table_privilege(t2.oid,t1.oid,'insert')
575 from (select oid from pg_class where relname = 'pg_authid') as t1,
576 (select oid from pg_roles where rolname = current_user) as t2;
578 ---------------------
582 select has_table_privilege('pg_authid','update');
584 ---------------------
588 select has_table_privilege('pg_authid','delete');
590 ---------------------
594 select has_table_privilege('pg_authid','truncate');
596 ---------------------
600 select has_table_privilege(t1.oid,'select')
601 from (select oid from pg_class where relname = 'pg_authid') as t1;
603 ---------------------
607 select has_table_privilege(t1.oid,'trigger')
608 from (select oid from pg_class where relname = 'pg_authid') as t1;
610 ---------------------
615 SET SESSION AUTHORIZATION regressuser3;
616 select has_table_privilege(current_user,'pg_class','select');
618 ---------------------
622 select has_table_privilege(current_user,'pg_class','insert');
624 ---------------------
628 select has_table_privilege(t2.oid,'pg_class','update')
629 from (select oid from pg_roles where rolname = current_user) as t2;
631 ---------------------
635 select has_table_privilege(t2.oid,'pg_class','delete')
636 from (select oid from pg_roles where rolname = current_user) as t2;
638 ---------------------
642 select has_table_privilege(current_user,t1.oid,'references')
643 from (select oid from pg_class where relname = 'pg_class') as t1;
645 ---------------------
649 select has_table_privilege(t2.oid,t1.oid,'select')
650 from (select oid from pg_class where relname = 'pg_class') as t1,
651 (select oid from pg_roles where rolname = current_user) as t2;
653 ---------------------
657 select has_table_privilege(t2.oid,t1.oid,'insert')
658 from (select oid from pg_class where relname = 'pg_class') as t1,
659 (select oid from pg_roles where rolname = current_user) as t2;
661 ---------------------
665 select has_table_privilege('pg_class','update');
667 ---------------------
671 select has_table_privilege('pg_class','delete');
673 ---------------------
677 select has_table_privilege('pg_class','truncate');
679 ---------------------
683 select has_table_privilege(t1.oid,'select')
684 from (select oid from pg_class where relname = 'pg_class') as t1;
686 ---------------------
690 select has_table_privilege(t1.oid,'trigger')
691 from (select oid from pg_class where relname = 'pg_class') as t1;
693 ---------------------
697 select has_table_privilege(current_user,'atest1','select');
699 ---------------------
703 select has_table_privilege(current_user,'atest1','insert');
705 ---------------------
709 select has_table_privilege(t2.oid,'atest1','update')
710 from (select oid from pg_roles where rolname = current_user) as t2;
712 ---------------------
716 select has_table_privilege(t2.oid,'atest1','delete')
717 from (select oid from pg_roles where rolname = current_user) as t2;
719 ---------------------
723 select has_table_privilege(current_user,t1.oid,'references')
724 from (select oid from pg_class where relname = 'atest1') as t1;
726 ---------------------
730 select has_table_privilege(t2.oid,t1.oid,'select')
731 from (select oid from pg_class where relname = 'atest1') as t1,
732 (select oid from pg_roles where rolname = current_user) as t2;
734 ---------------------
738 select has_table_privilege(t2.oid,t1.oid,'insert')
739 from (select oid from pg_class where relname = 'atest1') as t1,
740 (select oid from pg_roles where rolname = current_user) as t2;
742 ---------------------
746 select has_table_privilege('atest1','update');
748 ---------------------
752 select has_table_privilege('atest1','delete');
754 ---------------------
758 select has_table_privilege('atest1','truncate');
760 ---------------------
764 select has_table_privilege(t1.oid,'select')
765 from (select oid from pg_class where relname = 'atest1') as t1;
767 ---------------------
771 select has_table_privilege(t1.oid,'trigger')
772 from (select oid from pg_class where relname = 'atest1') as t1;
774 ---------------------
779 SET SESSION AUTHORIZATION regressuser1;
780 CREATE TABLE atest4 (a int);
781 GRANT SELECT ON atest4 TO regressuser2 WITH GRANT OPTION;
782 GRANT UPDATE ON atest4 TO regressuser2;
783 GRANT SELECT ON atest4 TO GROUP regressgroup1 WITH GRANT OPTION;
784 SET SESSION AUTHORIZATION regressuser2;
785 GRANT SELECT ON atest4 TO regressuser3;
786 GRANT UPDATE ON atest4 TO regressuser3; -- fail
787 WARNING: no privileges were granted for "atest4"
788 SET SESSION AUTHORIZATION regressuser1;
789 REVOKE SELECT ON atest4 FROM regressuser3; -- does nothing
790 SELECT has_table_privilege('regressuser3', 'atest4', 'SELECT'); -- true
792 ---------------------
796 REVOKE SELECT ON atest4 FROM regressuser2; -- fail
797 ERROR: dependent privileges exist
798 HINT: Use CASCADE to revoke them too.
799 REVOKE GRANT OPTION FOR SELECT ON atest4 FROM regressuser2 CASCADE; -- ok
800 SELECT has_table_privilege('regressuser2', 'atest4', 'SELECT'); -- true
802 ---------------------
806 SELECT has_table_privilege('regressuser3', 'atest4', 'SELECT'); -- false
808 ---------------------
812 SELECT has_table_privilege('regressuser1', 'atest4', 'SELECT WITH GRANT OPTION'); -- true
814 ---------------------
820 DROP FUNCTION testfunc2(int);
821 DROP FUNCTION testfunc4(boolean);
824 -- this should cascade to drop atestv4
825 DROP VIEW atestv3 CASCADE;
826 NOTICE: drop cascades to view atestv4
827 -- this should complain "does not exist"
829 ERROR: view "atestv4" does not exist
839 DROP GROUP regressgroup1;
840 DROP GROUP regressgroup2;
841 REVOKE USAGE ON LANGUAGE sql FROM regressuser1;
842 DROP USER regressuser1;
843 DROP USER regressuser2;
844 DROP USER regressuser3;
845 DROP USER regressuser4;
846 DROP USER regressuser5;