Skip to content

Commit 92b7902

Browse files
committed
Clean up some Coverity complaints about commit 0bf3ae8.
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.
1 parent ae507d9 commit 92b7902

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

contrib/postgres_fdw/deparse.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,10 @@ deparseDirectUpdateSql(StringInfo buf, PlannerInfo *root,
13561356
int attnum = lfirst_int(lc);
13571357
TargetEntry *tle = get_tle_by_resno(targetlist, attnum);
13581358

1359+
if (!tle)
1360+
elog(ERROR, "attribute number %d not found in UPDATE targetlist",
1361+
attnum);
1362+
13591363
if (!first)
13601364
appendStringInfoString(buf, ", ");
13611365
first = false;

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ postgresRecheckForeignScan(ForeignScanState *node, TupleTableSlot *slot)
20422042
* postgresPlanDirectModify
20432043
* Consider a direct foreign table modification
20442044
*
2045-
* Decide whether it is safe to modify a foreign table directly, and if so,
2045+
* Decide whether it is safe to modify a foreign table directly, and if so,
20462046
* rewrite subplan accordingly.
20472047
*/
20482048
static bool
@@ -2119,6 +2119,10 @@ postgresPlanDirectModify(PlannerInfo *root,
21192119

21202120
tle = get_tle_by_resno(subplan->targetlist, attno);
21212121

2122+
if (!tle)
2123+
elog(ERROR, "attribute number %d not found in subplan targetlist",
2124+
attno);
2125+
21222126
if (!is_foreign_expr(root, baserel, (Expr *) tle->expr))
21232127
return false;
21242128

@@ -3305,7 +3309,8 @@ process_query_params(ExprContext *econtext,
33053309
param_values[i] = NULL;
33063310
else
33073311
param_values[i] = OutputFunctionCall(&param_flinfo[i], expr_value);
3308-
i++;
3312+
3313+
i++;
33093314
}
33103315

33113316
reset_transmission_modes(nestlevel);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy