mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
RLS refactoring
This refactors rewrite/rowsecurity.c to simplify the handling of the default deny case (reducing the number of places where we check for and add the default deny policy from three to one) by splitting up the retrival of the policies from the application of them. This also allowed us to do away with the policy_id field. A policy_name field was added for WithCheckOption policies and is used in error reporting, when available. Patch by Dean Rasheed, with various mostly cosmetic changes by me. Back-patch to 9.5 where RLS was introduced to avoid unnecessary differences, since we're still in alpha, per discussion with Robert.
This commit is contained in:
@ -1786,8 +1786,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
|
||||
/*
|
||||
* Fetch any new security quals that must be applied to this RTE.
|
||||
*/
|
||||
get_row_security_policies(parsetree, parsetree->commandType, rte,
|
||||
rt_index, &securityQuals, &withCheckOptions,
|
||||
get_row_security_policies(parsetree, rte, rt_index,
|
||||
&securityQuals, &withCheckOptions,
|
||||
&hasRowSecurity, &hasSubLinks);
|
||||
|
||||
if (securityQuals != NIL || withCheckOptions != NIL)
|
||||
@ -3026,6 +3026,7 @@ rewriteTargetView(Query *parsetree, Relation view)
|
||||
wco = makeNode(WithCheckOption);
|
||||
wco->kind = WCO_VIEW_CHECK;
|
||||
wco->relname = pstrdup(RelationGetRelationName(view));
|
||||
wco->polname = NULL;
|
||||
wco->qual = NULL;
|
||||
wco->cascaded = cascaded;
|
||||
|
||||
|
Reference in New Issue
Block a user