On 2025/06/17 4:48, Ranier Vilela wrote:
Hi.

In the function *estimate_path_cost_size* the parameter
fpextra can be NULL.

Yes.


It is necessary to always check its validity,
as is already done in other parts of the source.

patch attached.

                                adjust_foreign_grouping_path_cost(root, 
pathkeys,
                                                                                
                  retrieved_rows, width,
-                                                                                  
               fpextra->limit_tuples,
+                                                                                  
               fpextra ? fpextra->limit_tuples : 0.0,
                                                                                    
              &disabled_nodes,
                                                                                        
          &startup_cost, &run_cost);

I couldn't find a query that would reach this code path with
fpextra == NULL, but I agree the current code is fragile.
So I think it's a good idea to add the check before accessing
the field.

Regards,

--
Fujii Masao
NTT DATA Japan Corporation



Reply via email to