aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/createplan.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-03-09 15:18:59 -0500
committerPeter Eisentraut <peter_e@gmx.net>2017-03-28 21:59:23 -0400
commit4cb824699e12c39fad97fb3d9085ced0d14c067c (patch)
tree9a835d8efb7739e6436d3fc24b4b5a290b95df7d /src/backend/optimizer/plan/createplan.c
parent66b764341ba12206f01e2600713bdc3abdb070b3 (diff)
downloadpostgresql-4cb824699e12c39fad97fb3d9085ced0d14c067c.tar.gz
postgresql-4cb824699e12c39fad97fb3d9085ced0d14c067c.zip
Cast result of copyObject() to correct type
copyObject() is declared to return void *, which allows easily assigning the result independent of the input, but it loses all type checking. If the compiler supports typeof or something similar, cast the result to the input type. This creates a greater amount of type safety. In some cases, where the result is assigned to a generic type such as Node * or Expr *, new casts are now necessary, but in general casts are now unnecessary in the normal case and indicate that something unusual is happening. Reviewed-by: Mark Dilger <hornschnorter@gmail.com>
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r--src/backend/optimizer/plan/createplan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index aafec58281b..d357479829f 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -1275,7 +1275,7 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path, int flags)
foreach(l, uniq_exprs)
{
- Node *uniqexpr = lfirst(l);
+ Expr *uniqexpr = lfirst(l);
TargetEntry *tle;
tle = tlist_member(uniqexpr, newtlist);
@@ -1318,7 +1318,7 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path, int flags)
groupColPos = 0;
foreach(l, uniq_exprs)
{
- Node *uniqexpr = lfirst(l);
+ Expr *uniqexpr = lfirst(l);
TargetEntry *tle;
tle = tlist_member(uniqexpr, newtlist);
@@ -4318,7 +4318,7 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
/* No, so add it */
nlp = makeNode(NestLoopParam);
nlp->paramno = pitem->paramId;
- nlp->paramval = copyObject(phv);
+ nlp->paramval = (Var *) copyObject(phv);
root->curOuterParams = lappend(root->curOuterParams, nlp);
}
}