diff options
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 76bda739357..c3039a6480e 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -1198,15 +1198,17 @@ postgresPlanForeignModify(PlannerInfo *root, } else if (operation == CMD_UPDATE) { - 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->modifiedCols, 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"); - targetAttrs = lappend_int(targetAttrs, col); + targetAttrs = lappend_int(targetAttrs, attno); } } |