Re: On disable_cost - Mailing list pgsql-hackers

From Alexander Lakhin
Subject Re: On disable_cost
Date
Msg-id a9b7231d-68bc-f117-a07c-96688f3e6aef@gmail.com
Whole thread Raw
In response to Re: On disable_cost  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: On disable_cost
List pgsql-hackers
Hello Robert,

21.08.2024 17:29, Robert Haas wrote:
> I went ahead and committed these patches. ...

Please take a look at the following code:
static void
label_sort_with_costsize(PlannerInfo *root, Sort *plan, double limit_tuples)
{
...
     cost_sort(&sort_path, root, NIL,
               lefttree->total_cost,
               plan->plan.disabled_nodes,
               lefttree->plan_rows,
               lefttree->plan_width,
               0.0,
               work_mem,
               limit_tuples);

Given the cost_sort() declaration:
void
cost_sort(Path *path, PlannerInfo *root,
           List *pathkeys, int input_disabled_nodes,
           Cost input_cost, double tuples, int width,
           Cost comparison_cost, int sort_mem,
           double limit_tuples)

Aren't the input_disabled_nodes and input_cost arguments swapped in the
above call?

(I've discovered this with UBSan, which complained
createplan.c:5457:6: runtime error: 4.40465e+09 is outside the range of representable values of type 'int'
while executing a query with a large estimated cost.)

Best regards,
Alexander



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
Next
From: Richard Guo
Date:
Subject: Re: On disable_cost