makeRangeVar for 9.5
authorTeodor Sigaev <teodor@sigaev.ru>
Tue, 3 Nov 2015 16:32:19 +0000 (19:32 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Tue, 3 Nov 2015 16:32:19 +0000 (19:32 +0300)
online_analyze.c

index 3f54bab..c4c2691 100644 (file)
@@ -46,6 +46,9 @@
 #include "utils/rel.h"
 #include "utils/relcache.h"
 #include "utils/timestamp.h"
+#if PG_VERSION_NUM >= 90500
+#include "nodes/makefuncs.h"
+#endif
 #endif
 
 #ifdef PG_MODULE_MAGIC
@@ -63,7 +66,7 @@ static ExecutorEnd_hook_type oldExecutorEndHook = NULL;
 static ProcessUtility_hook_type        oldProcessUtilityHook = NULL;
 #endif
 
-typedef enum 
+typedef enum
 {
        OATT_ALL                = 0x03,
        OATT_PERSISTENT = 0x01,
@@ -301,6 +304,19 @@ matchOid(TableList *tbl, Oid oid)
        return false;
 }
 
+#if PG_VERSION_NUM >= 90500
+static RangeVar*
+makeRangeVarFromOid(Oid relOid)
+{
+       return makeRangeVar(
+                               get_namespace_name(get_rel_namespace(relOid)),
+                               get_rel_name(relOid),
+                               -1
+                       );
+
+}
+#endif
+
 static void
 makeAnalyze(Oid relOid, CmdType operation, uint32 naffected)
 {
@@ -423,7 +439,7 @@ makeAnalyze(Oid relOid, CmdType operation, uint32 naffected)
                        , true
 #endif
 #else
-                       NULL /*RangeVar*/, VACOPT_ANALYZE | ((online_analyze_verbose) ? VACOPT_VERBOSE : 0),
+                       makeRangeVarFromOid(relOid), VACOPT_ANALYZE | ((online_analyze_verbose) ? VACOPT_VERBOSE : 0),
                        &vacstmt, NULL, true, GetAccessStrategy(BAS_VACUUM)
 #endif
                );