Use appropriate tuple descriptor in FDW batching
authorTomas Vondra <tomas.vondra@postgresql.org>
Thu, 12 Aug 2021 19:32:53 +0000 (21:32 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Thu, 12 Aug 2021 19:34:30 +0000 (21:34 +0200)
commit886531f3f403cae67a4537f0a2a1edc730f6b793
tree0142d315e57b322936f367e83fa1099783a8cbed
parent6458ed18fe40ac91f29496128dd1a49c0ef2db5b
Use appropriate tuple descriptor in FDW batching

The FDW batching code was using the same tuple descriptor both for all
slots (regular and plan slots), but that's incorrect - the subplan may
use a different descriptor. Currently this is benign, because batching
is used only for INSERTs, and in that case the descriptors always match.
But that would change if we allow batching UPDATEs.

Fix by copying the appropriate tuple descriptor. Backpatch to 14, where
the FDW batching was implemented.

Author: Amit Langote
Backpatch-through: 14, where FDW batching was added
Discussion: https://postgr.es/m/CA%2BHiwqEWd5B0-e-RvixGGUrNvGkjH2s4m95%3DJcwUnyV%3Df0rAKQ%40mail.gmail.com
src/backend/executor/nodeModifyTable.c