aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/analyze.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r--src/backend/parser/analyze.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 0f7659bb6be..796b5c9a5f9 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -824,8 +824,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
AttrNumber attr_num;
TargetEntry *tle;
- col = (ResTarget *) lfirst(icols);
- Assert(IsA(col, ResTarget));
+ col = castNode(ResTarget, lfirst(icols));
attr_num = (AttrNumber) lfirst_int(attnos);
tle = makeTargetEntry(expr,
@@ -950,8 +949,7 @@ transformInsertRow(ParseState *pstate, List *exprlist,
Expr *expr = (Expr *) lfirst(lc);
ResTarget *col;
- col = (ResTarget *) lfirst(icols);
- Assert(IsA(col, ResTarget));
+ col = castNode(ResTarget, lfirst(icols));
expr = transformAssignedExpr(pstate, expr,
EXPR_KIND_INSERT_TARGET,
@@ -1633,10 +1631,9 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
/*
* Recursively transform the components of the tree.
*/
- sostmt = (SetOperationStmt *) transformSetOperationTree(pstate, stmt,
- true,
- NULL);
- Assert(sostmt && IsA(sostmt, SetOperationStmt));
+ sostmt = castNode(SetOperationStmt,
+ transformSetOperationTree(pstate, stmt, true, NULL));
+ Assert(sostmt);
qry->setOperations = (Node *) sostmt;
/*
@@ -2298,8 +2295,7 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist)
}
if (orig_tl == NULL)
elog(ERROR, "UPDATE target count mismatch --- internal error");
- origTarget = (ResTarget *) lfirst(orig_tl);
- Assert(IsA(origTarget, ResTarget));
+ origTarget = castNode(ResTarget, lfirst(orig_tl));
attrno = attnameAttNum(pstate->p_target_relation,
origTarget->name, true);