2 -- Test for facilities of security label
5 SET client_min_messages TO 'warning';
6 DROP ROLE IF EXISTS regress_seclabel_user1;
7 DROP ROLE IF EXISTS regress_seclabel_user2;
8 RESET client_min_messages;
9 CREATE USER regress_seclabel_user1 WITH CREATEROLE;
10 CREATE USER regress_seclabel_user2;
11 CREATE TABLE seclabel_tbl1 (a int, b text);
12 CREATE TABLE seclabel_tbl2 (x int, y text);
13 CREATE VIEW seclabel_view1 AS SELECT * FROM seclabel_tbl2;
14 CREATE FUNCTION seclabel_four() RETURNS integer AS $$SELECT 4$$ language sql;
15 CREATE DOMAIN seclabel_domain AS text;
16 ALTER TABLE seclabel_tbl1 OWNER TO regress_seclabel_user1;
17 ALTER TABLE seclabel_tbl2 OWNER TO regress_seclabel_user2;
19 -- Test of SECURITY LABEL statement without a plugin
21 SECURITY LABEL ON TABLE seclabel_tbl1 IS 'classified'; -- fail
22 ERROR: no security label providers have been loaded
23 SECURITY LABEL FOR 'dummy' ON TABLE seclabel_tbl1 IS 'classified'; -- fail
24 ERROR: security label provider "dummy" is not loaded
25 SECURITY LABEL ON TABLE seclabel_tbl1 IS '...invalid label...'; -- fail
26 ERROR: no security label providers have been loaded
27 SECURITY LABEL ON TABLE seclabel_tbl3 IS 'unclassified'; -- fail
28 ERROR: no security label providers have been loaded
29 SECURITY LABEL ON ROLE regress_seclabel_user1 IS 'classified'; -- fail
30 ERROR: no security label providers have been loaded
31 SECURITY LABEL FOR 'dummy' ON ROLE regress_seclabel_user1 IS 'classified'; -- fail
32 ERROR: security label provider "dummy" is not loaded
33 SECURITY LABEL ON ROLE regress_seclabel_user1 IS '...invalid label...'; -- fail
34 ERROR: no security label providers have been loaded
35 SECURITY LABEL ON ROLE regress_seclabel_user3 IS 'unclassified'; -- fail
36 ERROR: no security label providers have been loaded
38 DROP FUNCTION seclabel_four();
39 DROP DOMAIN seclabel_domain;
40 DROP VIEW seclabel_view1;
41 DROP TABLE seclabel_tbl1;
42 DROP TABLE seclabel_tbl2;
43 DROP USER regress_seclabel_user1;
44 DROP USER regress_seclabel_user2;