Skip to content

Commit

Permalink
Issue - (EnterpriseDB#67) PostgreSQL 9.6 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrarahmed1974 committed Dec 15, 2016
1 parent 4b2947b commit df043d7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif

ifeq (,$(findstring $(MAJORVERSION), 9.3 9.4 9.5))
$(error PostgreSQL 9.3, 9.4 or 9.5 is required to compile this extension)
ifeq (,$(findstring $(MAJORVERSION), 9.3 9.4 9.5 9.6))
$(error PostgreSQL 9.3, 9.4, 9.5 or 9.6 is required to compile this extension)
endif
4 changes: 2 additions & 2 deletions Makefile.legacy
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif

ifeq (,$(findstring $(MAJORVERSION), 9.3 9.4 9.5))
$(error PostgreSQL 9.3, 9.4 or 9.5 is required to compile this extension)
ifeq (,$(findstring $(MAJORVERSION), 9.3 9.4 9.5 9.6))
$(error PostgreSQL 9.3, 9.4, 9.5 or 9.6 is required to compile this extension)
endif
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This [MongoDB][1] extension implements the PostgreSQL's Foreign Data Wrapper.

Please note that this version of mongo_fdw works with PostgreSQL and EDB Postgres Advanced Server 9.3, 9.4 and 9.5. Work is underway for certification with 9.6Beta.
Please note that this version of mongo_fdw works with PostgreSQL and EDB Postgres Advanced Server 9.3, 9.4, 9.5 and 9.6. Work is underway for certification with 9.6Beta.

Installation
------------
Expand Down
18 changes: 12 additions & 6 deletions mongo_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,20 @@ MongoGetForeignPaths(PlannerInfo *root, RelOptInfo *baserel, Oid foreignTableId)
}

/* create a foreign path node */
foreignPath = (Path *) create_foreignscan_path(root, baserel, baserel->rows,
startupCost, totalCost,
NIL, /* no pathkeys */
NULL, /* no outer rel either */

create_foreignscan_path(root, baserel,
#if PG_VERSION_NUM >= 90600
NULL, /* default pathtarget */
#endif
baserel->rows,
startupCost,
totalCost,
NIL, /* no pathkeys */
NULL, /* no outer rel either */
#if PG_VERSION_NUM >= 90500
NULL, /* no extra plan */
NULL, /* no extra plan */
#endif
NIL); /* no fdw_private data */
NULL); /* no fdw_private data */

/* add foreign path as the only possible path */
add_path(baserel, foreignPath);
Expand Down
11 changes: 9 additions & 2 deletions mongo_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,12 @@ ColumnList(RelOptInfo *baserel)
List *neededColumnList = NIL;
AttrNumber columnIndex = 1;
AttrNumber columnCount = baserel->max_attr;

#if PG_VERSION_NUM >= 90600
List *targetColumnList = baserel->reltarget->exprs;
#else
List *targetColumnList = baserel->reltargetlist;
#endif
List *restrictInfoList = baserel->baserestrictinfo;
ListCell *restrictInfoCell = NULL;

Expand All @@ -660,8 +665,10 @@ ColumnList(RelOptInfo *baserel)

/* recursively pull up any columns used in the restriction clause */
clauseColumnList = pull_var_clause(restrictClause,
PVC_RECURSE_AGGREGATES,
PVC_RECURSE_PLACEHOLDERS);
#if PG_VERSION_NUM < 90600
PVC_RECURSE_AGGREGATES,
#endif
PVC_RECURSE_PLACEHOLDERS);

neededColumnList = list_union(neededColumnList, clauseColumnList);
}
Expand Down

0 comments on commit df043d7

Please sign in to comment.