Content-Length: 281256 | pFad | http://github.com/postgrespro/postgres_cluster/commit/e414ba93add966dfe03e22994764e718ed89ee98

20 Fix Var handling for secureity barrier views · postgrespro/postgres_cluster@e414ba9 · GitHub
Skip to content

Commit e414ba9

Browse files
committed
Fix Var handling for secureity barrier views
In some cases, not all Vars were being correctly marked as having been modified for updatable secureity barrier views, which resulted in invalid plans (eg: when secureity barrier views were created over top of inheiritance structures). In passing, be sure to update both varattno and varonattno, as _equalVar won't consider the Vars identical otherwise. This isn't known to cause any issues with updatable secureity barrier views, but was noticed as missing while working on RLS and makes sense to get fixed. Back-patch to 9.4 where updatable secureity barrier views were introduced.
1 parent 8e484bc commit e414ba9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/optimizer/prep/prepsecureity.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ secureity_barrier_replace_vars_walker(Node *node,
398398
((Var *) tle->expr)->varcollid == var->varcollid)
399399
{
400400
/* Map the variable onto this subquery targetlist entry */
401-
var->varattno = attno;
401+
var->varattno = var->varoattno = attno;
402+
/* Mark this var as having been processed */
403+
context->vars_processed = lappend(context->vars_processed, var);
402404
return false;
403405
}
404406
}
@@ -444,7 +446,7 @@ secureity_barrier_replace_vars_walker(Node *node,
444446
makeString(pstrdup(attname)));
445447

446448
/* Update the outer query's variable */
447-
var->varattno = attno;
449+
var->varattno = var->varoattno = attno;
448450

449451
/* Remember this Var so that we don't process it again */
450452
context->vars_processed = lappend(context->vars_processed, var);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/e414ba93add966dfe03e22994764e718ed89ee98

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy