make compile on 9.2, although CREATE TABLE AS/SELECT INTO is not working yet
authorTeodor Sigaev <teodor@sigaev.ru>
Tue, 11 Sep 2012 18:27:38 +0000 (22:27 +0400)
committerTeodor Sigaev <teodor@sigaev.ru>
Tue, 11 Sep 2012 18:27:38 +0000 (22:27 +0400)
online_analyze.c

index 188e4db..a823216 100644 (file)
 #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;