Skip to content

Commit

Permalink
Merge pull request #114 from snaga/fix/pg96
Browse files Browse the repository at this point in the history
Add PostgreSQL 9.6 support.
  • Loading branch information
ibrarahmad authored Aug 29, 2016
2 parents 9bc8381 + d90d570 commit aa1ab56
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mysql_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,11 @@ mysqlGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntablei

_mysql_query(conn, "SET sql_mode='ANSI_QUOTES'");

#if PG_VERSION_NUM >= 90600
pull_varattnos((Node *) baserel->reltarget->exprs, baserel->relid, &attrs_used);
#else
pull_varattnos((Node *) baserel->reltargetlist, baserel->relid, &attrs_used);
#endif

foreach(lc, baserel->baserestrictinfo)
{
Expand All @@ -749,7 +753,11 @@ mysqlGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntablei
fpinfo->local_conds = lappend(fpinfo->local_conds, ri);
}

#if PG_VERSION_NUM >= 90600
pull_varattnos((Node *) baserel->reltarget->exprs, baserel->relid, &fpinfo->attrs_used);
#else
pull_varattnos((Node *) baserel->reltargetlist, baserel->relid, &fpinfo->attrs_used);
#endif
foreach(lc, fpinfo->local_conds)
{
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
Expand Down Expand Up @@ -948,6 +956,9 @@ mysqlGetForeignPaths(PlannerInfo *root,RelOptInfo *baserel,Oid foreigntableid)
/* Create a ForeignPath node and add it as only possible path */
add_path(baserel, (Path *)
create_foreignscan_path(root, baserel,
#if PG_VERSION_NUM >= 90600
NULL, /* default pathtarget */
#endif
baserel->rows,
startup_cost,
total_cost,
Expand Down

0 comments on commit aa1ab56

Please sign in to comment.