Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/backend/commands/copyfrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,19 @@ CopyMultiInsertBufferCleanup(CopyMultiInsertInfo *miinfo,
for (i = 0; i < MAX_BUFFERED_TUPLES && buffer->slots[i] != NULL; i++)
ExecDropSingleTupleTableSlot(buffer->slots[i]);

if (RelationIsNonblockRelation(buffer->resultRelInfo->ri_RelationDesc))
{
/*
* CBDB: do not call table_finish_bulk_insert for AO/AOCO or PAX tables.
* https://github.com/cloudberrydb/cloudberrydb/issues/547
* Do not clean up context or resource here, table_finish_bulk_insert
* routine will be called more than once during COPY FROM if
* the partition buffer is flushed but COPY is not finished.
*/
pfree(buffer);
return;
}

table_finish_bulk_insert(buffer->resultRelInfo->ri_RelationDesc,
miinfo->ti_options);

Expand Down Expand Up @@ -2531,9 +2544,6 @@ CopyFrom(CopyFromState cstate)

FreeExecutorState(estate);

/* GPDB_14_MERGE_FIXME: Do we need to call table_finish_bulk_insert here? */
table_finish_bulk_insert(cstate->rel, ti_options);

return processed;
}

Expand Down
Loading