mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Fix tuple routing to initialize batching only for inserts
A cross-partition update on a partitioned table is implemented as a delete followed by an insert. With foreign partitions, this was however causing issues, because the FDW and core may disagree on when to enable batching. postgres_fdw was only allowing batching for plain inserts (CMD_INSERT) while core was trying to batch the insert component of the cross-partition update. Fix by restricting core to apply batching only to plain CMD_INSERT queries. It's possible to allow batching for cross-partition updates, but that will require more extensive changes, so better to leave that for a separate patch. Author: Amit Langote Reviewed-by: Tomas Vondra, Takayuki Tsunakawa Discussion: https://postgr.es/m/20200628151002.7x5laxwpgvkyiu3q@development
This commit is contained in:
@ -1000,7 +1000,8 @@ ExecInitRoutingInfo(ModifyTableState *mtstate,
|
||||
*
|
||||
* If the FDW does not support batching, we set the batch size to 1.
|
||||
*/
|
||||
if (partRelInfo->ri_FdwRoutine != NULL &&
|
||||
if (mtstate->operation == CMD_INSERT &&
|
||||
partRelInfo->ri_FdwRoutine != NULL &&
|
||||
partRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize &&
|
||||
partRelInfo->ri_FdwRoutine->ExecForeignBatchInsert)
|
||||
partRelInfo->ri_BatchSize =
|
||||
|
Reference in New Issue
Block a user