Ensure a few policies remain for pg_upgrade
authorStephen Frost <[email protected]>
Mon, 28 Sep 2015 19:48:36 +0000 (15:48 -0400)
committerPavan Deolasee <[email protected]>
Wed, 26 Oct 2016 07:46:08 +0000 (13:16 +0530)
To make sure that pg_dump/pg_restore function properly with RLS
policies, arrange to have a few of them left around at the end of the
regression tests.

Back-patch to 9.5 where RLS was added.

src/test/regress/expected/rowsecurity.out
src/test/regress/output/misc.source
src/test/regress/sql/rowsecurity.sql

index de6b61878993b3dead00e2fd6a9ea9604f613600..d4402b9cf3ad294fcf94dde6b186f7b64c68154b 100644 (file)
@@ -3249,3 +3249,12 @@ DROP USER rls_regress_user2;
 DROP USER rls_regress_exempt_user;
 DROP ROLE rls_regress_group1;
 DROP ROLE rls_regress_group2;
+-- Arrange to have a few policies left over, for testing
+-- pg_dump/pg_restore
+CREATE SCHEMA rls_regress_schema;
+CREATE TABLE rls_tbl (c1 int);
+ALTER TABLE rls_tbl ENABLE ROW LEVEL SECURITY;
+CREATE POLICY p1 ON rls_tbl USING (c1 > 5);
+CREATE POLICY p2 ON rls_tbl FOR SELECT USING (c1 <= 3);
+CREATE POLICY p3 ON rls_tbl FOR UPDATE USING (c1 <= 3) WITH CHECK (c1 > 5);
+CREATE POLICY p4 ON rls_tbl FOR DELETE USING (c1 <= 3);
index 472148b9c0fe6da2c6dcf33c57fc7fecbc9a6c4c..bf2306f67f6be4dd1e835331e6d46de266136aa2 100644 (file)
@@ -679,6 +679,7 @@ SELECT user_relns() AS user_relns
  random_tbl
  real_city
  reltime_tbl
+ rls_tbl
  road
  shighway
  slow_emp4000
@@ -716,7 +717,7 @@ SELECT user_relns() AS user_relns
  tvvmv
  varchar_tbl
  xacttest
-(130 rows)
+(131 rows)
 
 SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer')));
  name 
index 86909f88e5ab2a15927a7f5a379128071fa1ffdd..39d3922caae0deb33900bbf9140df0c783e88578 100644 (file)
@@ -1174,3 +1174,13 @@ DROP USER rls_regress_user2;
 DROP USER rls_regress_exempt_user;
 DROP ROLE rls_regress_group1;
 DROP ROLE rls_regress_group2;
+
+-- Arrange to have a few policies left over, for testing
+-- pg_dump/pg_restore
+CREATE SCHEMA rls_regress_schema;
+CREATE TABLE rls_tbl (c1 int);
+ALTER TABLE rls_tbl ENABLE ROW LEVEL SECURITY;
+CREATE POLICY p1 ON rls_tbl USING (c1 > 5);
+CREATE POLICY p2 ON rls_tbl FOR SELECT USING (c1 <= 3);
+CREATE POLICY p3 ON rls_tbl FOR UPDATE USING (c1 <= 3) WITH CHECK (c1 > 5);
+CREATE POLICY p4 ON rls_tbl FOR DELETE USING (c1 <= 3);