Skip to content

Commit

Permalink
Fix a build issue with v11.
Browse files Browse the repository at this point in the history
Upstream commit 8237f27b504ff1d1e2da7ae4c81a7f72ea0e0e3e removed
get_relid_attribute_name and added missing_ok get_attname so it
can serve the purpose of get_relid_attribute_name.  This commit
replace get_relid_attribute_name() to get_attname().
  • Loading branch information
rblathia committed Nov 1, 2018
1 parent 83b7134 commit 09b4248
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mongo_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,11 @@ MongoExecForeignUpdate(EState *estate,
/* Get the id that was passed up as a resjunk column */
datum = ExecGetJunkAttribute(planSlot, 1, &isNull);

#if PG_VERSION_NUM < 110000
columnName = get_relid_attribute_name(foreignTableId, 1);
#else
columnName = get_attname(foreignTableId, 1, false);
#endif

typoid = get_atttype(foreignTableId, 1);

Expand Down Expand Up @@ -1061,7 +1065,11 @@ MongoExecForeignDelete(EState *estate,
/* Get the id that was passed up as a resjunk column */
datum = ExecGetJunkAttribute(planSlot, 1, &isNull);

#if PG_VERSION_NUM < 110000
columnName = get_relid_attribute_name(foreignTableId, 1);
#else
columnName = get_attname(foreignTableId, 1, false);
#endif

typoid = get_atttype(foreignTableId, 1);

Expand Down Expand Up @@ -1177,7 +1185,11 @@ ColumnMappingHash(Oid foreignTableId, List *columnList)
bool handleFound = false;
void *hashKey = NULL;

#if PG_VERSION_NUM < 110000
columnName = get_relid_attribute_name(foreignTableId, columnId);
#else
columnName = get_attname(foreignTableId, columnId, false);
#endif
hashKey = (void *) columnName;

columnMapping = (ColumnMapping *) hash_search(columnMappingHash, hashKey,
Expand Down
8 changes: 8 additions & 0 deletions mongo_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ QueryDocument(Oid relationId, List *opExpressionList, ForeignScanState *scanStat
paramNode = (Param *) FindArgumentOfType(argumentList, T_Param);

columnId = column->varattno;
#if PG_VERSION_NUM < 110000
columnName = get_relid_attribute_name(relationId, columnId);
#else
columnName = get_attname(relationId, columnId, false);
#endif

if (constant != NULL)
AppendConstantValue(queryDocument, columnName, constant);
Expand Down Expand Up @@ -238,7 +242,11 @@ QueryDocument(Oid relationId, List *opExpressionList, ForeignScanState *scanStat
BSON r;

columnId = column->varattno;
#if PG_VERSION_NUM < 110000
columnName = get_relid_attribute_name(relationId, columnId);
#else
columnName = get_attname(relationId, columnId, false);
#endif

/* find all expressions that correspond to the column */
columnOperatorList = ColumnOperatorList(column, comparisonOperatorList);
Expand Down

0 comments on commit 09b4248

Please sign in to comment.