Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b2be5cb

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 364de74 commit b2be5cb

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
@@ -7914,11 +7914,11 @@ get_name_for_var_field(Var *var, int fieldno,
79147914
{
79157915
char *dummy_name = palloc(32);
79167916

7917-
Assert(IsA(dpns->plan, Result));
7917+
Assert(dpns->plan && IsA(dpns->plan, Result));
79187918
snprintf(dummy_name, 32, "f%d", fieldno);
79197919
return dummy_name;
79207920
}
7921-
Assert(IsA(dpns->plan, SubqueryScan));
7921+
Assert(dpns->plan && IsA(dpns->plan, SubqueryScan));
79227922

79237923
tle = get_tle_by_resno(dpns->inner_tlist, attnum);
79247924
if (!tle)
@@ -8045,12 +8045,12 @@ get_name_for_var_field(Var *var, int fieldno,
80458045
{
80468046
char *dummy_name = palloc(32);
80478047

8048-
Assert(IsA(dpns->plan, Result));
8048+
Assert(dpns->plan && IsA(dpns->plan, Result));
80498049
snprintf(dummy_name, 32, "f%d", fieldno);
80508050
return dummy_name;
80518051
}
8052-
Assert(IsA(dpns->plan, CteScan) ||
8053-
IsA(dpns->plan, WorkTableScan));
8052+
Assert(dpns->plan && (IsA(dpns->plan, CteScan) ||
8053+
IsA(dpns->plan, WorkTableScan)));
80548054

80558055
tle = get_tle_by_resno(dpns->inner_tlist, attnum);
80568056
if (!tle)

0 commit comments

Comments
 (0)