aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2015-04-24 09:38:10 -0400
committerStephen Frost <sfrost@snowman.net>2015-04-24 09:38:10 -0400
commitcb087ec03bbb1d52845a4de83a6bf634dac2639f (patch)
tree610877111dff85700037924a3a5fdd554dfd3ed5 /src
parent62420ae7d6675453a48e408b62030b6f0780e878 (diff)
downloadpostgresql-cb087ec03bbb1d52845a4de83a6bf634dac2639f.tar.gz
postgresql-cb087ec03bbb1d52845a4de83a6bf634dac2639f.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/rewrite/rowsecurity.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c
index bad166ac3ad..e060353bff8 100644
--- a/src/backend/rewrite/rowsecurity.c
+++ b/src/backend/rewrite/rowsecurity.c
@@ -259,7 +259,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
WithCheckOption *wco;
wco = (WithCheckOption *) makeNode(WithCheckOption);
- wco->viewname = RelationGetRelationName(rel);
+ wco->viewname = pstrdup(RelationGetRelationName(rel));
wco->qual = (Node *) hook_with_check_expr_restrictive;
wco->cascaded = false;
*withCheckOptions = lappend(*withCheckOptions, wco);
@@ -274,7 +274,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
WithCheckOption *wco;
wco = (WithCheckOption *) makeNode(WithCheckOption);
- wco->viewname = RelationGetRelationName(rel);
+ wco->viewname = pstrdup(RelationGetRelationName(rel));
wco->qual = (Node *) rowsec_with_check_expr;
wco->cascaded = false;
*withCheckOptions = lappend(*withCheckOptions, wco);
@@ -285,7 +285,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
WithCheckOption *wco;
wco = (WithCheckOption *) makeNode(WithCheckOption);
- wco->viewname = RelationGetRelationName(rel);
+ wco->viewname = pstrdup(RelationGetRelationName(rel));
wco->qual = (Node *) hook_with_check_expr_permissive;
wco->cascaded = false;
*withCheckOptions = lappend(*withCheckOptions, wco);
@@ -303,7 +303,7 @@ get_row_security_policies(Query* root, RangeTblEntry* rte, int rt_index,
combined_qual_eval = makeBoolExpr(OR_EXPR, combined_quals, -1);
wco = (WithCheckOption *) makeNode(WithCheckOption);
- wco->viewname = RelationGetRelationName(rel);
+ wco->viewname = pstrdup(RelationGetRelationName(rel));
wco->qual = (Node *) combined_qual_eval;
wco->cascaded = false;
*withCheckOptions = lappend(*withCheckOptions, wco);