projects
/
online_analyze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1376db9
)
support pgsql 10
author
Teodor Sigaev
<teodor@sigaev.ru>
Wed, 5 Apr 2017 15:39:41 +0000
(18:39 +0300)
committer
Teodor Sigaev
<teodor@sigaev.ru>
Wed, 5 Apr 2017 15:39:41 +0000
(18:39 +0300)
online_analyze.c
patch
|
blob
|
history
diff --git
a/online_analyze.c
b/online_analyze.c
index
b1a3578
..
f9c8ffd
100644
(file)
--- a/
online_analyze.c
+++ b/
online_analyze.c
@@
-50,6
+50,10
@@
#include "utils/timestamp.h"
#if PG_VERSION_NUM >= 90500
#include "nodes/makefuncs.h"
#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
#endif
#endif
@@
-111,6
+115,7
@@
static HTAB *relstats = NULL;
static void relstatsInit(void);
static void relstatsInit(void);
+#if PG_VERSION_NUM < 100000
static int
oid_cmp(const void *a, const void *b)
{
static int
oid_cmp(const void *a, const void *b)
{
@@
-118,6
+123,7
@@
oid_cmp(const void *a, const void *b)
return 0;
return (*(Oid*)a > *(Oid*)b) ? 1 : -1;
}
return 0;
return (*(Oid*)a > *(Oid*)b) ? 1 : -1;
}
+#endif
static const char *
tableListAssign(const char * newval, bool doit, TableList *tbl)
static const char *
tableListAssign(const char * newval, bool doit, TableList *tbl)
@@
-607,22
+613,45
@@
onlineAnalyzeHooker(QueryDesc *queryDesc)
#if PG_VERSION_NUM >= 90200
static void
#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 >= 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;
#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);
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 (oldProcessUtilityHook)
oldProcessUtilityHook(parsetree, queryString,
#if PG_VERSION_NUM >= 90300
context, params,
+#if PG_VERSION_NUM >= 100000
+ queryEnv,
+#endif
#else
params, isTopLevel,
#endif
#else
params, isTopLevel,
#endif
@@
-631,11
+660,18
@@
onlineAnalyzeHookerUtility(Node *parsetree, const char *queryString,
standard_ProcessUtility(parsetree, queryString,
#if PG_VERSION_NUM >= 90300
context, params,
standard_ProcessUtility(parsetree, queryString,
#if PG_VERSION_NUM >= 90300
context, params,
+#if PG_VERSION_NUM >= 100000
+ queryEnv,
+#endif
#else
params, isTopLevel,
#endif
dest, completionTag);
#else
params, isTopLevel,
#endif
dest, completionTag);
+#if PG_VERSION_NUM >= 100000
+#undef parsetree
+#endif
+
if (tblname) {
Oid tblOid = RangeVarGetRelid(tblname, NoLock, true);
if (tblname) {
Oid tblOid = RangeVarGetRelid(tblname, NoLock, true);