From 14e9a758e05dd5467bab85ef98fad76b8dbfcc87 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Tue, 11 Sep 2012 22:27:38 +0400 Subject: [PATCH] make compile on 9.2, although CREATE TABLE AS/SELECT INTO is not working yet --- online_analyze.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/online_analyze.c b/online_analyze.c index 188e4db..a823216 100644 --- a/online_analyze.c +++ b/online_analyze.c @@ -39,6 +39,12 @@ #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/guc.h" +#if PG_VERSION_NUM >= 90200 +#include "catalog/pg_class.h" +#include "utils/rel.h" +#include "utils/relcache.h" +#include "utils/timestamp.h" +#endif #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; @@ -112,7 +118,11 @@ tableListAssign(const char * newval, bool doit, TableList *tbl) foreach(l, namelist) { char *curname = (char *) lfirst(l); - Oid relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)), true); + Oid relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)), +#if PG_VERSION_NUM >= 90200 + NoLock, +#endif + true); if (relOid == InvalidOid) { @@ -428,15 +438,23 @@ onlineAnalyzeHooker(QueryDesc *queryDesc) (queryDesc->operation == CMD_INSERT || queryDesc->operation == CMD_UPDATE || queryDesc->operation == CMD_DELETE || - (queryDesc->operation == CMD_SELECT && queryDesc->plannedstmt->intoClause))) +#if PG_VERSION_NUM >= 90200 + 0 /* (queryDesc->operation == CMD_SELECT && queryDesc->dest && queryDesc->dest == DestIntoRel) */ +#else + (queryDesc->operation == CMD_SELECT && queryDesc->plannedstmt->intoClause) +#endif + )) { - if (queryDesc->plannedstmt->intoClause) +#if PG_VERSION_NUM < 90200 + if (queryDesc->operation == CMD_SELECT) { Oid relOid = RangeVarGetRelid(queryDesc->plannedstmt->intoClause->rel, true); makeAnalyze(relOid, queryDesc->operation, naffected); } - else if (queryDesc->plannedstmt->resultRelations && + else +#endif + if (queryDesc->plannedstmt->resultRelations && queryDesc->plannedstmt->rtable) { ListCell *l; -- 2.46.1