Skip to content

Commit 16e67bc

Browse files
committed
Suppress Coverity warnings about Asserts in get_name_for_var_field.
Coverity thinks dpns->plan could be null at these points. That shouldn't really be possible, but it's easy enough to modify the Asserts so they'd not core-dump if it were true. These are new in b919a97. Back-patch to v13; the v12 version of the patch didn't have these Asserts.
1 parent 2f4e895 commit 16e67bc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/utils/adt/ruleutils.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7897,11 +7897,11 @@ get_name_for_var_field(Var *var, int fieldno,
78977897
{
78987898
char *dummy_name = palloc(32);
78997899

7900-
Assert(IsA(dpns->plan, Result));
7900+
Assert(dpns->plan && IsA(dpns->plan, Result));
79017901
snprintf(dummy_name, 32, "f%d", fieldno);
79027902
return dummy_name;
79037903
}
7904-
Assert(IsA(dpns->plan, SubqueryScan));
7904+
Assert(dpns->plan && IsA(dpns->plan, SubqueryScan));
79057905

79067906
tle = get_tle_by_resno(dpns->inner_tlist, attnum);
79077907
if (!tle)
@@ -8028,12 +8028,12 @@ get_name_for_var_field(Var *var, int fieldno,
80288028
{
80298029
char *dummy_name = palloc(32);
80308030

8031-
Assert(IsA(dpns->plan, Result));
8031+
Assert(dpns->plan && IsA(dpns->plan, Result));
80328032
snprintf(dummy_name, 32, "f%d", fieldno);
80338033
return dummy_name;
80348034
}
8035-
Assert(IsA(dpns->plan, CteScan) ||
8036-
IsA(dpns->plan, WorkTableScan));
8035+
Assert(dpns->plan && (IsA(dpns->plan, CteScan) ||
8036+
IsA(dpns->plan, WorkTableScan)));
80378037

80388038
tle = get_tle_by_resno(dpns->inner_tlist, attnum);
80398039
if (!tle)

0 commit comments

Comments
 (0)