Skip to content

Instantly share code, notes, and snippets.

@mc-soi
Last active September 5, 2015 04:11
Show Gist options
  • Save mc-soi/6b4a504bc1393c4ba9f4 to your computer and use it in GitHub Desktop.
Save mc-soi/6b4a504bc1393c4ba9f4 to your computer and use it in GitHub Desktop.
informix_fdw patch for PostgreSQL 9.5
diff --git a/ifx_fdw.c b/ifx_fdw.c
index fab4df8..4d83ee4 100644
--- a/ifx_fdw.c
+++ b/ifx_fdw.c
@@ -1829,13 +1829,15 @@ static void ifxPrepareParamsForModify(IfxFdwExecutionState *state,
* Shamelessly stolen from src/contrib/postgres_fdw.
*/
RangeTblEntry *rte = planner_rt_fetch(resultRelation, planInfo);
- Bitmapset *tmpset = bms_copy(rte->modifiedCols);
- AttrNumber col;
+ int col;
- while ((col = bms_first_member(tmpset)) >= 0)
+ col = -1;
+ while ((col = bms_next_member(rte->updatedCols, col)) >= 0)
{
- col += FirstLowInvalidHeapAttributeNumber;
- if (col <= InvalidAttrNumber) /* shouldn't happen */
+ /* bit numbers are offset by FirstLowInvalidHeapAttributeNumber */
+ AttrNumber attno = col + FirstLowInvalidHeapAttributeNumber;
+
+ if (attno <= InvalidAttrNumber) /* shouldn't happen */
elog(ERROR, "system-column update is not supported");
state->affectedAttrNums = lappend_int(state->affectedAttrNums,
col);
@@ -3200,7 +3202,8 @@ static ForeignScan *ifxGetForeignPlan(PlannerInfo *root,
scan_clauses,
scan_relid,
NIL,
- plan_values);
+ plan_values,
+ NIL);
}
#else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment