#include "utils/timestamp.h"
#if PG_VERSION_NUM >= 90500
#include "nodes/makefuncs.h"
+#if PG_VERSION_NUM >= 100000
+#include "utils/varlena.h"
+#include "utils/regproc.h"
+#endif
#endif
#endif
static void relstatsInit(void);
+#if PG_VERSION_NUM < 100000
static int
oid_cmp(const void *a, const void *b)
{
return 0;
return (*(Oid*)a > *(Oid*)b) ? 1 : -1;
}
+#endif
static const char *
tableListAssign(const char * newval, bool doit, TableList *tbl)
#if PG_VERSION_NUM >= 90200
static void
-onlineAnalyzeHookerUtility(Node *parsetree, const char *queryString,
+onlineAnalyzeHookerUtility(
+#if PG_VERSION_NUM >= 100000
+ PlannedStmt *pstmt,
+#else
+ Node *parsetree,
+#endif
+ const char *queryString,
#if PG_VERSION_NUM >= 90300
ProcessUtilityContext context, ParamListInfo params,
+#if PG_VERSION_NUM >= 100000
+ QueryEnvironment *queryEnv,
+#endif
#else
ParamListInfo params, bool isTopLevel,
#endif
DestReceiver *dest, char *completionTag) {
RangeVar *tblname = NULL;
+#if PG_VERSION_NUM >= 100000
+ Node *parsetree = NULL;
+
+ if (pstmt->commandType == CMD_UTILITY)
+ parsetree = pstmt->utilityStmt;
+#endif
- if (IsA(parsetree, CreateTableAsStmt) && ((CreateTableAsStmt*)parsetree)->into)
+ if (parsetree && IsA(parsetree, CreateTableAsStmt) &&
+ ((CreateTableAsStmt*)parsetree)->into)
tblname = (RangeVar*)copyObject(((CreateTableAsStmt*)parsetree)->into->rel);
+#if PG_VERSION_NUM >= 100000
+#define parsetree pstmt
+#endif
+
if (oldProcessUtilityHook)
oldProcessUtilityHook(parsetree, queryString,
#if PG_VERSION_NUM >= 90300
context, params,
+#if PG_VERSION_NUM >= 100000
+ queryEnv,
+#endif
#else
params, isTopLevel,
#endif
standard_ProcessUtility(parsetree, queryString,
#if PG_VERSION_NUM >= 90300
context, params,
+#if PG_VERSION_NUM >= 100000
+ queryEnv,
+#endif
#else
params, isTopLevel,
#endif
dest, completionTag);
+#if PG_VERSION_NUM >= 100000
+#undef parsetree
+#endif
+
if (tblname) {
Oid tblOid = RangeVarGetRelid(tblname, NoLock, true);