diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c index 245a260982..203289f7f2 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -329,7 +329,8 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize != NULL); /* Flush into foreign table or partition */ - do { + while(sent < nused) + { int size = (resultRelInfo->ri_BatchSize < nused - sent) ? resultRelInfo->ri_BatchSize : (nused - sent); int inserted = size; @@ -340,7 +341,7 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, NULL, &inserted); sent += size; - } while (sent < nused); + } } else {