2020-06-01 21:43:16 +00:00
|
|
|
-- default
|
2022-02-21 03:54:28 +00:00
|
|
|
CREATE ROW POLICY p1_01295 ON db.table
|
2020-06-01 21:43:16 +00:00
|
|
|
-- same as default
|
2022-02-21 03:54:28 +00:00
|
|
|
CREATE ROW POLICY p2_01295 ON db.table
|
|
|
|
CREATE ROW POLICY p3_01295 ON db.table
|
2020-06-01 21:43:16 +00:00
|
|
|
-- rename
|
2022-02-21 03:54:28 +00:00
|
|
|
CREATE ROW POLICY p2_01295_renamed ON db.table
|
2020-06-01 21:43:16 +00:00
|
|
|
-- filter
|
2022-02-21 03:54:28 +00:00
|
|
|
CREATE ROW POLICY p1_01295 ON db.table FOR SELECT USING (a < b) AND (c > d)
|
|
|
|
CREATE ROW POLICY p2_01295 ON db.table AS restrictive FOR SELECT USING id = currentUser()
|
|
|
|
CREATE ROW POLICY p3_01295 ON db.table FOR SELECT USING 1
|
|
|
|
CREATE ROW POLICY p1_01295 ON db.table AS restrictive FOR SELECT USING 0
|
2020-06-01 21:43:16 +00:00
|
|
|
-- to roles
|
2022-02-21 03:54:28 +00:00
|
|
|
CREATE ROW POLICY p1_01295 ON db.table
|
|
|
|
CREATE ROW POLICY p2_01295 ON db.table TO ALL
|
|
|
|
CREATE ROW POLICY p3_01295 ON db.table TO r1_01295
|
|
|
|
CREATE ROW POLICY p4_01295 ON db.table TO u1_01295
|
|
|
|
CREATE ROW POLICY p5_01295 ON db.table TO r1_01295, u1_01295
|
|
|
|
CREATE ROW POLICY p6_01295 ON db.table TO ALL EXCEPT r1_01295
|
|
|
|
CREATE ROW POLICY p7_01295 ON db.table TO ALL EXCEPT r1_01295, u1_01295
|
|
|
|
CREATE ROW POLICY p1_01295 ON db.table TO u1_01295
|
|
|
|
CREATE ROW POLICY p2_01295 ON db.table
|
2020-06-01 21:43:16 +00:00
|
|
|
-- multiple policies in one command
|
2022-02-21 03:54:28 +00:00
|
|
|
CREATE ROW POLICY p1_01295 ON db.table FOR SELECT USING 1
|
|
|
|
CREATE ROW POLICY p2_01295 ON db.table FOR SELECT USING 1
|
|
|
|
CREATE ROW POLICY p3_01295 ON db.table TO u1_01295
|
|
|
|
CREATE ROW POLICY p3_01295 ON db2.table2 TO u1_01295
|
|
|
|
CREATE ROW POLICY p4_01295 ON db.table FOR SELECT USING a = b
|
|
|
|
CREATE ROW POLICY p5_01295 ON db2.table2 FOR SELECT USING a = b
|
|
|
|
CREATE ROW POLICY p1_01295 ON db.table FOR SELECT USING 1 TO ALL
|
|
|
|
CREATE ROW POLICY p2_01295 ON db.table FOR SELECT USING 1 TO ALL
|
2020-06-01 21:43:16 +00:00
|
|
|
-- system.row_policies
|
2022-02-21 03:54:28 +00:00
|
|
|
p1_01295 ON db.table p1_01295 db table local directory (a < b) AND (c > d) 0 0 [] []
|
|
|
|
p2_01295 ON db.table p2_01295 db table local directory id = currentUser() 1 0 ['u1_01295'] []
|
|
|
|
p3_01295 ON db.table p3_01295 db table local directory 1 0 1 [] ['r1_01295']
|