Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 14e9a75

Browse files
committed
make compile on 9.2, although CREATE TABLE AS/SELECT INTO is not working yet
1 parent e7737f1 commit 14e9a75

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

online_analyze.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
#include "utils/builtins.h"
4040
#include "utils/lsyscache.h"
4141
#include "utils/guc.h"
42+
#if PG_VERSION_NUM >= 90200
43+
#include "catalog/pg_class.h"
44+
#include "utils/rel.h"
45+
#include "utils/relcache.h"
46+
#include "utils/timestamp.h"
47+
#endif
4248

4349
#ifdef PG_MODULE_MAGIC
4450
PG_MODULE_MAGIC;
@@ -112,7 +118,11 @@ tableListAssign(const char * newval, bool doit, TableList *tbl)
112118
foreach(l, namelist)
113119
{
114120
char *curname = (char *) lfirst(l);
115-
Oid relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)), true);
121+
Oid relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)),
122+
#if PG_VERSION_NUM >= 90200
123+
NoLock,
124+
#endif
125+
true);
116126

117127
if (relOid == InvalidOid)
118128
{
@@ -428,15 +438,23 @@ onlineAnalyzeHooker(QueryDesc *queryDesc)
428438
(queryDesc->operation == CMD_INSERT ||
429439
queryDesc->operation == CMD_UPDATE ||
430440
queryDesc->operation == CMD_DELETE ||
431-
(queryDesc->operation == CMD_SELECT && queryDesc->plannedstmt->intoClause)))
441+
#if PG_VERSION_NUM >= 90200
442+
0 /* (queryDesc->operation == CMD_SELECT && queryDesc->dest && queryDesc->dest == DestIntoRel) */
443+
#else
444+
(queryDesc->operation == CMD_SELECT && queryDesc->plannedstmt->intoClause)
445+
#endif
446+
))
432447
{
433-
if (queryDesc->plannedstmt->intoClause)
448+
#if PG_VERSION_NUM < 90200
449+
if (queryDesc->operation == CMD_SELECT)
434450
{
435451
Oid relOid = RangeVarGetRelid(queryDesc->plannedstmt->intoClause->rel, true);
436452

437453
makeAnalyze(relOid, queryDesc->operation, naffected);
438454
}
439-
else if (queryDesc->plannedstmt->resultRelations &&
455+
else
456+
#endif
457+
if (queryDesc->plannedstmt->resultRelations &&
440458
queryDesc->plannedstmt->rtable)
441459
{
442460
ListCell *l;

0 commit comments

Comments
 (0)