Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc46c0e5

Browse files
committed
Fix transition tables for wCTEs.
The original coding didn't handle this case properly; each separateDML substatement needs its own set of transitions.Patch by Thomas MunroDiscussion:https://postgr.es/m/CAL9smLCDQ%3D2o024rBgtD4WihzX8B3C6u_oSQ2K3%2BR5grJrV0bg%40mail.gmail.com
1 parent501ed02 commitc46c0e5

File tree

7 files changed

+174
-148
lines changed

7 files changed

+174
-148
lines changed

‎src/backend/commands/copy.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,12 @@ BeginCopy(ParseState *pstate,
14161416
errmsg("table \"%s\" does not have OIDs",
14171417
RelationGetRelationName(cstate->rel))));
14181418

1419+
/*
1420+
* If there are any triggers with transition tables on the named
1421+
* relation, we need to be prepared to capture transition tuples.
1422+
*/
1423+
cstate->transition_capture=MakeTransitionCaptureState(rel->trigdesc);
1424+
14191425
/* Initialize state for CopyFrom tuple routing. */
14201426
if (is_from&&rel->rd_rel->relkind==RELKIND_PARTITIONED_TABLE)
14211427
{
@@ -1439,14 +1445,6 @@ BeginCopy(ParseState *pstate,
14391445
cstate->partition_tupconv_maps=partition_tupconv_maps;
14401446
cstate->partition_tuple_slot=partition_tuple_slot;
14411447

1442-
/*
1443-
* If there are any triggers with transition tables on the named
1444-
* relation, we need to be prepared to capture transition tuples
1445-
* from child relations too.
1446-
*/
1447-
cstate->transition_capture=
1448-
MakeTransitionCaptureState(rel->trigdesc);
1449-
14501448
/*
14511449
* If we are capturing transition tuples, they may need to be
14521450
* converted from partition format back to partitioned table
@@ -2807,7 +2805,7 @@ CopyFrom(CopyState cstate)
28072805
pq_endmsgread();
28082806

28092807
/* Execute AFTER STATEMENT insertion triggers */
2810-
ExecASInsertTriggers(estate,resultRelInfo);
2808+
ExecASInsertTriggers(estate,resultRelInfo,cstate->transition_capture);
28112809

28122810
/* Handle queued AFTER triggers */
28132811
AfterTriggerEndQuery(estate);
@@ -2935,7 +2933,7 @@ CopyFromInsertBatch(CopyState cstate, EState *estate, CommandId mycid,
29352933
cstate->cur_lineno=firstBufferedLineNo+i;
29362934
ExecARInsertTriggers(estate,resultRelInfo,
29372935
bufferedTuples[i],
2938-
NIL,NULL);
2936+
NIL,cstate->transition_capture);
29392937
}
29402938
}
29412939

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp