From 90f334d2ca1a8bae2d0cd8a0898fb8ef90257565 Mon Sep 17 00:00:00 2001 From: Stephen Frost Date: Sun, 4 Oct 2015 21:05:18 -0400 Subject: ALTER TABLE .. FORCE ROW LEVEL SECURITY To allow users to force RLS to always be applied, even for table owners, add ALTER TABLE .. FORCE ROW LEVEL SECURITY. row_security=off overrides FORCE ROW LEVEL SECURITY, to ensure pg_dump output is complete (by default). Also add SECURITY_NOFORCE_RLS context to avoid data corruption when ALTER TABLE .. FORCE ROW SECURITY is being used. The SECURITY_NOFORCE_RLS security context is used only during referential integrity checks and is only considered in check_enable_rls() after we have already checked that the current user is the owner of the relation (which should always be the case during referential integrity checks). Back-patch to 9.5 where RLS was added. --- doc/src/sgml/catalogs.sgml | 10 ++++++++++ doc/src/sgml/ref/alter_table.sgml | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 4a75b5f33d4..90a137bc0d3 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1971,6 +1971,16 @@ + + relforcerowsecurity + bool + + + True if row level security (when enabled) will also apply to table owner; see + pg_policy catalog + + + relispopulated bool diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 776401fc205..9fea2702bac 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -61,6 +61,8 @@ ALTER TABLE ALL IN TABLESPACE name ENABLE ALWAYS RULE rewrite_rule_name DISABLE ROW LEVEL SECURITY ENABLE ROW LEVEL SECURITY + FORCE ROW LEVEL SECURITY + NO FORCE ROW LEVEL SECURITY CLUSTER ON index_name SET WITHOUT CLUSTER SET WITH OIDS @@ -431,6 +433,21 @@ ALTER TABLE ALL IN TABLESPACE name + + NO FORCE/FORCE ROW LEVEL SECURITY + + + These forms control the application of row security policies belonging + to the table when the user is the table owner. If enabled, row level + security policies will be applied when the user is the table owner. If + disabled (the default) then row level security will not be applied when + the user is the table owner. + See also + . + + + + CLUSTER ON -- cgit v1.2.3