Commit 92b7902d authored by Tom Lane's avatar Tom Lane

Clean up some Coverity complaints about commit 0bf3ae88.

The two get_tle_by_resno() calls introduced by this commit lacked any
check for a NULL return, unlike any other calls of that function anywhere
in our tree.  Coverity quite properly complained about it.  Also fix a
misindented line in process_query_params(), which Coverity also complained
about on the grounds that the bad indentation suggested possible programmer
misinterpretation.
parent ae507d92
...@@ -1356,6 +1356,10 @@ deparseDirectUpdateSql(StringInfo buf, PlannerInfo *root, ...@@ -1356,6 +1356,10 @@ deparseDirectUpdateSql(StringInfo buf, PlannerInfo *root,
int attnum = lfirst_int(lc); int attnum = lfirst_int(lc);
TargetEntry *tle = get_tle_by_resno(targetlist, attnum); TargetEntry *tle = get_tle_by_resno(targetlist, attnum);
if (!tle)
elog(ERROR, "attribute number %d not found in UPDATE targetlist",
attnum);
if (!first) if (!first)
appendStringInfoString(buf, ", "); appendStringInfoString(buf, ", ");
first = false; first = false;
......
...@@ -2119,6 +2119,10 @@ postgresPlanDirectModify(PlannerInfo *root, ...@@ -2119,6 +2119,10 @@ postgresPlanDirectModify(PlannerInfo *root,
tle = get_tle_by_resno(subplan->targetlist, attno); tle = get_tle_by_resno(subplan->targetlist, attno);
if (!tle)
elog(ERROR, "attribute number %d not found in subplan targetlist",
attno);
if (!is_foreign_expr(root, baserel, (Expr *) tle->expr)) if (!is_foreign_expr(root, baserel, (Expr *) tle->expr))
return false; return false;
...@@ -3305,6 +3309,7 @@ process_query_params(ExprContext *econtext, ...@@ -3305,6 +3309,7 @@ process_query_params(ExprContext *econtext,
param_values[i] = NULL; param_values[i] = NULL;
else else
param_values[i] = OutputFunctionCall(&param_flinfo[i], expr_value); param_values[i] = OutputFunctionCall(&param_flinfo[i], expr_value);
i++; i++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment