mirror of
https://github.com/HypoPG/hypopg
synced 2026-05-24 09:38:21 +00:00
Compile and use on Windows (#36)
* Add PGDLLEXPORT to functions called externally
* Make it compile with Visual Studio (it doesn't support #ifdef in macros)
* Add explicit type-cast so silence compiler warnings.
* Replace {INT_MAX | INT32_MAX } with PG_INT32_MAX
(cherry picked from commit 4a5dc56169)
This commit is contained in:
parent
7a79114f54
commit
3f89878e3e
3 changed files with 12 additions and 13 deletions
8
hypopg.c
8
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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue