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
5 changes: 5 additions & 0 deletions src/backend/commands/copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,11 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
*processed = CopyDispatchOnSegment(stmt);
else
*processed = CopyFrom(cstate); /* copy from file to database */

/* Handle copy to replicated table returns processed number */
if (Gp_role == GP_ROLE_DISPATCH && cstate->rel->rd_cdbpolicy &&
cstate->rel->rd_cdbpolicy->ptype == POLICYTYPE_REPLICATED)
*processed = *processed / cstate->rel->rd_cdbpolicy->numsegments;
}
PG_CATCH();
{
Expand Down
6 changes: 3 additions & 3 deletions src/test/isolation2/expected/ao_unique_index.out
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +390,20 @@ CREATE
1: BEGIN;
BEGIN
1: COPY unique_index_ao_row FROM PROGRAM 'seq 1 10';
COPY 30
COPY 10
-- concurrent tx inserting conflicting row should block.
2&: COPY unique_index_ao_row FROM PROGRAM 'seq 1 1'; <waiting ...>
-- concurrent tx inserting non-conflicting rows should be successful.
3: COPY unique_index_ao_row FROM PROGRAM 'seq 11 20';
COPY 30
COPY 10
-- inserting a conflicting row in the same transaction should ERROR out.
1: COPY unique_index_ao_row FROM PROGRAM 'seq 1 1';
ERROR: duplicate key value violates unique constraint "unique_index_ao_row_a_key"
DETAIL: Key (a)=(1) already exists.
CONTEXT: COPY unique_index_ao_row, line 1
-- now that tx 1 was aborted, tx 2 is successful.
2<: <... completed>
COPY 3
COPY 1
1: END;
END

Expand Down
6 changes: 3 additions & 3 deletions src/test/isolation2/expected/aocs_unique_index.out
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +390,20 @@ CREATE
1: BEGIN;
BEGIN
1: COPY unique_index_ao_column FROM PROGRAM 'seq 1 10';
COPY 30
COPY 10
-- concurrent tx inserting conflicting row should block.
2&: COPY unique_index_ao_column FROM PROGRAM 'seq 1 1'; <waiting ...>
-- concurrent tx inserting non-conflicting rows should be successful.
3: COPY unique_index_ao_column FROM PROGRAM 'seq 11 20';
COPY 30
COPY 10
-- inserting a conflicting row in the same transaction should ERROR out.
1: COPY unique_index_ao_column FROM PROGRAM 'seq 1 1';
ERROR: duplicate key value violates unique constraint "unique_index_ao_column_a_key"
DETAIL: Key (a)=(1) already exists.
CONTEXT: COPY unique_index_ao_column, line 1
-- now that tx 1 was aborted, tx 2 is successful.
2<: <... completed>
COPY 3
COPY 1
1: END;
END

Expand Down