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

Commit920f853

Browse files
committed
Fix initialization of FDW batching in ExecInitModifyTable
ExecInitModifyTable has to initialize batching for all result relations,not just the first one. Furthermore, when junk filters were necessary,the pointer pointed past the mtstate->resultRelInfo array.Per reports from multiple non-x86 animals (florican, locust, ...).Discussion:https://postgr.es/m/20200628151002.7x5laxwpgvkyiu3q@development
1 parent733d670 commit920f853

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

‎src/backend/executor/nodeModifyTable.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,18 +2797,29 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
27972797
* Determine if the FDW supports batch insert and determine the batch
27982798
* size (a FDW may support batching, but it may be disabled for the
27992799
* server/table).
2800+
*
2801+
* We only do this for INSERT, so that for UPDATE/DELETE the batch
2802+
* size remains set to 0.
28002803
*/
2801-
if (!resultRelInfo->ri_usesFdwDirectModify&&
2802-
operation==CMD_INSERT&&
2803-
resultRelInfo->ri_FdwRoutine!=NULL&&
2804-
resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize&&
2805-
resultRelInfo->ri_FdwRoutine->ExecForeignBatchInsert)
2806-
resultRelInfo->ri_BatchSize=
2807-
resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize(resultRelInfo);
2808-
else
2809-
resultRelInfo->ri_BatchSize=1;
2804+
if (operation==CMD_INSERT)
2805+
{
2806+
resultRelInfo=mtstate->resultRelInfo;
2807+
for (i=0;i<nplans;i++)
2808+
{
2809+
if (!resultRelInfo->ri_usesFdwDirectModify&&
2810+
resultRelInfo->ri_FdwRoutine!=NULL&&
2811+
resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize&&
2812+
resultRelInfo->ri_FdwRoutine->ExecForeignBatchInsert)
2813+
resultRelInfo->ri_BatchSize=
2814+
resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize(resultRelInfo);
2815+
else
2816+
resultRelInfo->ri_BatchSize=1;
2817+
2818+
Assert(resultRelInfo->ri_BatchSize >=1);
28102819

2811-
Assert(resultRelInfo->ri_BatchSize >=1);
2820+
resultRelInfo++;
2821+
}
2822+
}
28122823

28132824
/*
28142825
* Lastly, if this is not the primary (canSetTag) ModifyTable node, add it

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp