Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-06 Thread Ranier Vilela
Em qua., 5 de fev. de 2025 às 15:56, Tom Lane escreveu: > So I don't > find it to be an improvement. > Ok, I'm withdrawing this patch. Thanks to everyone who contributed to the thread. best regards, Ranier Vilela

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ilia Evdokimov
On 05.02.2025 21:56, Tom Lane wrote: It's not a bug. Since the call specifies NIL pathkeys (meaning it doesn't care about sort order) and does not insist on a parallel-safe path, there should always be a path that satisfies it. The only way it could fail to find a path is if the rel's pathlist

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Tom Lane
Daniel Gustafsson writes: > On 5 Feb 2025, at 18:34, Ranier Vilela wrote: >> This is evidence that we do not have reports about this bug. > Before that can be stated it needs to be determined if this is a bug, this > thread has not done that yet. It's not a bug. Since the call specifies NIL pa

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Daniel Gustafsson
> On 5 Feb 2025, at 18:34, Ranier Vilela wrote: > Em qua., 5 de fev. de 2025 às 14:08, Daniel Gustafsson > escreveu: >> 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 w

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ranier Vilela
Hi. Em qua., 5 de fev. de 2025 às 14:08, Daniel Gustafsson escreveu: > > On 5 Jan 2025, at 00:29, Ranier Vilela 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 func

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ranier Vilela
Em qua., 5 de fev. de 2025 às 14:09, Ilia Evdokimov < ilya.evdoki...@tantorlabs.com> escreveu: > But what should we do if cheapest == NULL further? Should we return NULL > of get_cheapest_parameterized_child_path() function? > > If it is, we should write it like this: > > if (cheapset == NULL || b

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ilia Evdokimov
But what should we do if cheapest == NULL further? Should we return NULL of get_cheapest_parameterized_child_path() function? If it is, we should write it like this: if (cheapset == NULL || bms(PATH_REQ_OUTER(cheapset), required_outer))     return cheapest; I'll look into this issue further.

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Daniel Gustafsson
> On 5 Jan 2025, at 00:29, Ranier Vilela 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 effect

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ranier Vilela
Hi. Em qua., 5 de fev. de 2025 às 13:51, Ilia Evdokimov < ilya.evdoki...@tantorlabs.com> escreveu: > > On 05.01.2025 02:29, Ranier Vilela wrote: > > Hi. > > > > Per Coverity. > > > > All call sites of function *get_cheapest_path_for_pathkeys* checks > > for NULL returns. > > > > So, it is highly

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ilia Evdokimov
On 05.01.2025 02:29, Ranier Vilela 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 Ass