Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49b4950

Browse files
committed
Add explicit cast to amcostestimate call.
My compiler doesn't complain here, but David Rowley's does ...
1 parent 65c5fcd commit 49b4950

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/optimizer/path/costsize.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,10 @@ cost_index(IndexPath *path, PlannerInfo *root, double loop_count)
419419
* Call index-access-method-specific code to estimate the processing cost
420420
* for scanning the index, as well as the selectivity of the index (ie,
421421
* the fraction of main-table tuples we will have to retrieve) and its
422-
* correlation to the main-table tuple order.
422+
* correlation to the main-table tuple order. We need a cast here because
423+
* relation.h uses a weak function type to avoid including amapi.h.
423424
*/
424-
amcostestimate = index->amcostestimate; /* cast to proper type */
425+
amcostestimate = (amcostestimate_function) index->amcostestimate;
425426
amcostestimate(root, path, loop_count,
426427
&indexStartupCost, &indexTotalCost,
427428
&indexSelectivity, &indexCorrelation);

0 commit comments

Comments
 (0)