From: Teodor Sigaev Date: Thu, 24 Nov 2016 09:04:21 +0000 (+0300) Subject: fix compile with pg < 9.6, fix memory context allocation X-Git-Url: http://sigaev.ru/git/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Flocal_hash;p=online_analyze.git fix compile with pg < 9.6, fix memory context allocation --- 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);