Fix unnecessary casts of copyObject() result
authorPeter Eisentraut <[email protected]>
Thu, 17 Oct 2024 06:36:14 +0000 (08:36 +0200)
committerPeter Eisentraut <[email protected]>
Thu, 17 Oct 2024 06:36:48 +0000 (08:36 +0200)
The result is already of the correct type, so these casts don't do
anything.

Reviewed-by: Nathan Bossart <[email protected]>
Reviewed-by: Tender Wang <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/637eeea8-5663-460b-a114-39572c0f6c6e%40eisentraut.org

src/backend/commands/trigger.c
src/backend/nodes/nodeFuncs.c
src/backend/rewrite/rewriteManip.c

index 3671e82535e2f3aeb9553ffdc4c221ac2fccbdf9..09356e46d16028c32c7b2423785a0c51f21e8db1 100644 (file)
@@ -1169,7 +1169,7 @@ CreateTriggerFiringOn(CreateTrigStmt *stmt, const char *queryString,
             * Initialize our fabricated parse node by copying the original
             * one, then resetting fields that we pass separately.
             */
-           childStmt = (CreateTrigStmt *) copyObject(stmt);
+           childStmt = copyObject(stmt);
            childStmt->funcname = NIL;
            childStmt->whenClause = NULL;
 
index 0d00e029f32230d027b9853ca1799ac457063ca1..f76072228c9d2d69cfc9197d365e76f7ad219f5a 100644 (file)
@@ -2996,7 +2996,7 @@ expression_tree_mutator_impl(Node *node,
        case T_SortGroupClause:
        case T_CTESearchClause:
        case T_MergeSupportFunc:
-           return (Node *) copyObject(node);
+           return copyObject(node);
        case T_WithCheckOption:
            {
                WithCheckOption *wco = (WithCheckOption *) node;
@@ -3604,7 +3604,7 @@ expression_tree_mutator_impl(Node *node,
            break;
        case T_PartitionPruneStepCombine:
            /* no expression sub-nodes */
-           return (Node *) copyObject(node);
+           return copyObject(node);
        case T_JoinExpr:
            {
                JoinExpr   *join = (JoinExpr *) node;
index b20625fbd2b35cafd2240e846939fbd80829f8c2..8f90afb32691f17bc875b10085b07ee4ca7626be 100644 (file)
@@ -1715,7 +1715,7 @@ ReplaceVarsFromTargetList_callback(Var *var,
                break;
 
            case REPLACEVARS_CHANGE_VARNO:
-               var = (Var *) copyObject(var);
+               var = copyObject(var);
                var->varno = rcon->nomatch_varno;
                /* we leave the syntactic referent alone */
                return (Node *) var;