diff --git a/hypopg.c b/hypopg.c index 419938a..3153e78 100644 --- a/hypopg.c +++ b/hypopg.c @@ -31,10 +31,10 @@ MemoryContext HypoMemoryContext; /*--- Functions --- */ -void _PG_init(void); -void _PG_fini(void); +PGDLLEXPORT void _PG_init(void); +PGDLLEXPORT void _PG_fini(void); -Datum hypopg_reset(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum hypopg_reset(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(hypopg_reset); @@ -334,7 +334,7 @@ hypo_get_relation_info_hook(PlannerInfo *root, /* * Reset statistics. */ -Datum +PGDLLEXPORT Datum hypopg_reset(PG_FUNCTION_ARGS) { hypo_index_reset(); diff --git a/hypopg_index.c b/hypopg_index.c index 935817b..ed97529 100644 --- a/hypopg_index.c +++ b/hypopg_index.c @@ -1668,8 +1668,7 @@ hypo_estimate_index(hypoIndex *entry, RelOptInfo *rel) - (fillfactor == 0 ? BTREE_DEFAULT_FILLFACTOR : fillfactor) + additional_bloat) / 100; - entry->pages = - entry->tuples * line_size * bloat_factor / usable_page_size; + entry->pages = (BlockNumber) (entry->tuples * line_size * bloat_factor / usable_page_size); #if PG_VERSION_NUM >= 90300 entry->tree_height = -1; /* TODO */ #endif @@ -1751,7 +1750,7 @@ hypo_estimate_index(hypoIndex *entry, RelOptInfo *rel) sizeof_SignType * bloomLength; entry->pages = 1; /* meta page */ - entry->pages += ceil( + entry->pages += (BlockNumber) ceil( ((double) entry->tuples * line_size) / usable_page_size); } #endif diff --git a/include/hypopg_index.h b/include/hypopg_index.h index fc00af1..3738533 100644 --- a/include/hypopg_index.h +++ b/include/hypopg_index.h @@ -111,12 +111,12 @@ extern List *hypoIndexes; void hypo_index_reset(void); -Datum hypopg(PG_FUNCTION_ARGS); -Datum hypopg_create_index(PG_FUNCTION_ARGS); -Datum hypopg_drop_index(PG_FUNCTION_ARGS); -Datum hypopg_relation_size(PG_FUNCTION_ARGS); -Datum hypopg_get_indexdef(PG_FUNCTION_ARGS); -Datum hypopg_reset_index(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum hypopg(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum hypopg_create_index(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum hypopg_drop_index(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum hypopg_relation_size(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum hypopg_get_indexdef(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum hypopg_reset_index(PG_FUNCTION_ARGS); extern explain_get_index_name_hook_type prev_explain_get_index_name_hook; const char *hypo_explain_get_index_name_hook(Oid indexId);