aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/rewrite/rowsecurity.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c
index eebc493849f..5c61f7e0132 100644
--- a/src/backend/rewrite/rowsecurity.c
+++ b/src/backend/rewrite/rowsecurity.c
@@ -78,7 +78,8 @@ static void add_with_check_options(Relation rel,
List *permissive_policies,
List *restrictive_policies,
List **withCheckOptions,
- bool *hasSubLinks);
+ bool *hasSubLinks,
+ bool force_using);
static bool check_role_for_policy(ArrayType *policy_roles, Oid user_id);
@@ -269,7 +270,8 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index,
permissive_policies,
restrictive_policies,
withCheckOptions,
- hasSubLinks);
+ hasSubLinks,
+ false);
/*
* Get and add ALL/SELECT policies, if SELECT rights are required
@@ -292,7 +294,8 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index,
select_permissive_policies,
select_restrictive_policies,
withCheckOptions,
- hasSubLinks);
+ hasSubLinks,
+ true);
}
/*
@@ -321,7 +324,8 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index,
conflict_permissive_policies,
conflict_restrictive_policies,
withCheckOptions,
- hasSubLinks);
+ hasSubLinks,
+ true);
/*
* Get and add ALL/SELECT policies, as WCO_RLS_CONFLICT_CHECK
@@ -343,7 +347,8 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index,
conflict_select_permissive_policies,
conflict_select_restrictive_policies,
withCheckOptions,
- hasSubLinks);
+ hasSubLinks,
+ true);
}
/* Enforce the WITH CHECK clauses of the UPDATE policies */
@@ -352,7 +357,8 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index,
conflict_permissive_policies,
conflict_restrictive_policies,
withCheckOptions,
- hasSubLinks);
+ hasSubLinks,
+ false);
}
}
@@ -641,13 +647,14 @@ add_with_check_options(Relation rel,
List *permissive_policies,
List *restrictive_policies,
List **withCheckOptions,
- bool *hasSubLinks)
+ bool *hasSubLinks,
+ bool force_using)
{
ListCell *item;
List *permissive_quals = NIL;
#define QUAL_FOR_WCO(policy) \
- ( kind != WCO_RLS_CONFLICT_CHECK && \
+ ( !force_using && \
(policy)->with_check_qual != NULL ? \
(policy)->with_check_qual : (policy)->qual )