diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-03-09 15:18:59 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-03-28 21:59:23 -0400 |
commit | 4cb824699e12c39fad97fb3d9085ced0d14c067c (patch) | |
tree | 9a835d8efb7739e6436d3fc24b4b5a290b95df7d /src/backend/rewrite/rewriteManip.c | |
parent | 66b764341ba12206f01e2600713bdc3abdb070b3 (diff) |
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/rewrite/rewriteManip.c')
-rw-r--r-- | src/backend/rewrite/rewriteManip.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index b23a3b7046e..da02cfd25ca 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -1412,11 +1412,11 @@ ReplaceVarsFromTargetList_callback(Var *var, else { /* Make a copy of the tlist item to return */ - Node *newnode = copyObject(tle->expr); + Expr *newnode = copyObject(tle->expr); /* Must adjust varlevelsup if tlist item is from higher query */ if (var->varlevelsup > 0) - IncrementVarSublevelsUp(newnode, var->varlevelsup, 0); + IncrementVarSublevelsUp((Node *) newnode, var->varlevelsup, 0); /* * Check to see if the tlist item contains a PARAM_MULTIEXPR Param, @@ -1428,12 +1428,12 @@ ReplaceVarsFromTargetList_callback(Var *var, * create semantic oddities that users of rules would probably prefer * not to cope with. So treat it as an unimplemented feature. */ - if (contains_multiexpr_param(newnode, NULL)) + if (contains_multiexpr_param((Node *) newnode, NULL)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("NEW variables in ON UPDATE rules cannot reference columns that are part of a multiple assignment in the subject UPDATE command"))); - return newnode; + return (Node *) newnode; } } |