From 1376db930b4cc3ba46ee7f83a1baed16e5f4b69b Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Thu, 24 Nov 2016 12:04:21 +0300 Subject: [PATCH] fix compile with pg < 9.6, fix memory context allocation --- online_analyze.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/online_analyze.c b/online_analyze.c index 93276ab..b1a3578 100644 --- a/online_analyze.c +++ b/online_analyze.c @@ -109,7 +109,7 @@ typedef struct OnlineAnalyzeTableStat { static MemoryContext onlineAnalyzeMemoryContext = NULL; static HTAB *relstats = NULL; -static void relstatsInit(); +static void relstatsInit(void); static int oid_cmp(const void *a, const void *b) @@ -645,7 +645,7 @@ onlineAnalyzeHookerUtility(Node *parsetree, const char *queryString, #endif static void -relstatsInit() +relstatsInit(void) { HASHCTL hash_ctl; int flags = 0; @@ -666,12 +666,17 @@ relstatsInit() onlineAnalyzeMemoryContext = AllocSetContextCreate(CacheMemoryContext, "online_analyze storage context", - ALLOCSET_DEFAULT_SIZES); +#if PG_VERSION_NUM < 90600 + ALLOCSET_DEFAULT_MINSIZE, + ALLOCSET_DEFAULT_INITSIZE, + ALLOCSET_DEFAULT_MAXSIZE +#else + ALLOCSET_DEFAULT_SIZES +#endif + ); } - hash_ctl.hcxt = AllocSetContextCreate(CacheMemoryContext, - "online_analyze storage context", - ALLOCSET_DEFAULT_SIZES); + hash_ctl.hcxt = onlineAnalyzeMemoryContext; flags |= HASH_CONTEXT; hash_ctl.keysize = sizeof(Oid); -- 2.46.1