Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c) - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
Date
Msg-id E2392586-80AF-4FEE-8811-940F1F0DD194@yesql.se
Whole thread Raw
Responses Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
List pgsql-hackers
> On 5 Jan 2025, at 00:29, Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> Hi.
>
> Per Coverity.
>
> All call sites of function *get_cheapest_path_for_pathkeys* checks
> for NULL returns.
>
> So, it is highly likely that the function will return NULL.
>
> IMO, the Assert in this particular call, is not fully effective.
>
> Fix removing the Assert and always check if the return is NULL.

Yet the author wrote an Assert here (over a decade ago), so rather than blindly
changing that it seems reasonable to motivate a patch like this with an
investigation on what the Assert means here.  The fact that Coverity complains
is far from conclusive evidence that something is wrong.

--
Daniel Gustafsson




pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
Next
From: Ilia Evdokimov
Date:
Subject: Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)