From: Alvaro Herrera Date: Wed, 20 Apr 2022 09:44:08 +0000 (+0200) Subject: set_deparse_plan: Reuse variable to appease Coverity X-Git-Tag: REL_15_BETA1~127 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e70813fbc4aaca35ec012d5a426706bd54e4acab;p=thirdparty%2Fpostgresql.git set_deparse_plan: Reuse variable to appease Coverity Coverity complains that dpns->outer_plan is deferenced (to obtain ->targetlist) when possibly NULL. We can avoid this by using dpns->outer_tlist instead, which was already obtained a few lines up. The fact that we end up with dpns->inner_tlist = dpns->outer_tlist is a bit suspicious-looking and maybe worthy of more investigation, but I'll leave that for another day. Reviewed-by: Michaƫl Paquier Discussion: https://postgr.es/m/202204191345.qerjy3kxi3eb@alvherre.pgsql --- diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 7e08d7fe6c2..5d49f564a2e 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -4996,7 +4996,7 @@ set_deparse_plan(deparse_namespace *dpns, Plan *plan) if (IsA(plan, ModifyTable)) { if (((ModifyTable *) plan)->operation == CMD_MERGE) - dpns->inner_tlist = dpns->outer_plan->targetlist; + dpns->inner_tlist = dpns->outer_tlist; else dpns->inner_tlist = ((ModifyTable *) plan)->exclRelTlist; }