aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2021-02-18 00:02:00 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2021-02-18 00:03:45 +0100
commit927f453a941061e3d5884bab206581c34784e45b (patch)
treed959c78ac87ff1274b292e3f8a26f7a1eb7c1986 /src/backend/executor
parentc15283ff429bf318f161bf84768795843b22696d (diff)
downloadpostgresql-927f453a941061e3d5884bab206581c34784e45b.tar.gz
postgresql-927f453a941061e3d5884bab206581c34784e45b.zip
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
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execPartition.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index b9e4f2d80b1..b8da4c5967d 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -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 =