fix compile with pg < 9.6, fix memory context allocation local_hash
authorTeodor Sigaev <teodor@sigaev.ru>
Thu, 24 Nov 2016 09:04:21 +0000 (12:04 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Thu, 24 Nov 2016 09:04:21 +0000 (12:04 +0300)
online_analyze.c

index 93276ab..b1a3578 100644 (file)
@@ -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);