Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cb087ec

Browse files
committed
Copy the relation name for error reporting in WCOs
In get_row_security_policies(), we need to make a copy of the relation name when building the WithCheckOptions structure, since RelationGetRelationName just returns a pointer into the local Relation structure. The relation name in the WCO structure is only used for error reporting. Pointed out by Robert and Christian Ullrich, who noted that the buildfarm members with -DCLOBBER_CACHE_ALWAYS were failing.
1 parent 62420ae commit cb087ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/rewrite/rowsecurity.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
259259
WithCheckOption *wco;
260260

261261
wco = (WithCheckOption *) makeNode(WithCheckOption);
262-
wco->viewname = RelationGetRelationName(rel);
262+
wco->viewname = pstrdup(RelationGetRelationName(rel));
263263
wco->qual = (Node *) hook_with_check_expr_restrictive;
264264
wco->cascaded = false;
265265
*withCheckOptions = lappend(*withCheckOptions, wco);
@@ -274,7 +274,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
274274
WithCheckOption *wco;
275275

276276
wco = (WithCheckOption *) makeNode(WithCheckOption);
277-
wco->viewname = RelationGetRelationName(rel);
277+
wco->viewname = pstrdup(RelationGetRelationName(rel));
278278
wco->qual = (Node *) rowsec_with_check_expr;
279279
wco->cascaded = false;
280280
*withCheckOptions = lappend(*withCheckOptions, wco);
@@ -285,7 +285,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
285285
WithCheckOption *wco;
286286

287287
wco = (WithCheckOption *) makeNode(WithCheckOption);
288-
wco->viewname = RelationGetRelationName(rel);
288+
wco->viewname = pstrdup(RelationGetRelationName(rel));
289289
wco->qual = (Node *) hook_with_check_expr_permissive;
290290
wco->cascaded = false;
291291
*withCheckOptions = lappend(*withCheckOptions, wco);
@@ -303,7 +303,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
303303
combined_qual_eval = makeBoolExpr(OR_EXPR, combined_quals, -1);
304304

305305
wco = (WithCheckOption *) makeNode(WithCheckOption);
306-
wco->viewname = RelationGetRelationName(rel);
306+
wco->viewname = pstrdup(RelationGetRelationName(rel));
307307
wco->qual = (Node *) combined_qual_eval;
308308
wco->cascaded = false;
309309
*withCheckOptions = lappend(*withCheckOptions, wco);

0 commit comments

Comments
 (0)