was generated by the
<structname>ModifyTable</structname> plan node's subplan; it differs from
<literal>slot</literal> in possibly containing additional <quote>junk</quote>
columns. (The <literal>planSlot</literal> is typically of little interest
for <command>INSERT</command> cases, but is provided for completeness.)
</para>
<para>
The return value is either a slot containing the data that was actually
inserted (this might differ from the data supplied, for example as a
result of trigger actions), or NULL if no row was actually inserted
(again, typically as a result of triggers). The passed-in
<literal>slot</literal> can be re-used for this purpose.
</para>
<para>
The data in the returned slot is used only if the <command>INSERT</command>
statement has a <literal>RETURNING</literal> clause or involves a view
<literal>WITH CHECK OPTION</literal>; or if the foreign table has
an <literal>AFTER ROW</literal> trigger. Triggers require all columns,
but the FDW could choose to optimize away returning some or all columns
depending on the contents of the <literal>RETURNING</literal> clause or
<literal>WITH CHECK OPTION</literal> constraints. Regardless, some slot
must be returned to indicate success, or the query's reported row count
will be wrong.
</para>
<para>
If the <function>ExecForeignInsert</function> pointer is set to
<literal>NULL</literal>, attempts to insert into the foreign table will fail
with an error message.
</para>
<para>
Note that this function is also called when inserting routed tuples into
a foreign-table partition or executing <command>COPY FROM</command> on
a foreign table, in which case it is called in a different way than it
is in the <command>INSERT</command> case. See the callback functions
described below that allow the FDW to support that.
</para>
<para>
<programlisting>
TupleTableSlot **
ExecForeignBatchInsert(EState *estate,
ResultRelInfo *rinfo,
TupleTableSlot **slots,
TupleTableSlot **planSlots,
int *numSlots);
</programlisting>
Insert multiple tuples in bulk into the foreign table.
The parameters are the same for <function>ExecForeignInsert</function>
except <literal>slots</literal> and <literal>planSlots</literal> contain
multiple tuples and <literal>*numSlots</literal> specifies the number of
tuples in those arrays.
</para>
<para>
The return value is an array of slots containing the data that was
actually inserted (this might differ from the data supplied, for
example as a result of trigger actions.)
The passed-in <literal>slots</literal> can be re-used for this purpose.
The number of successfully inserted tuples is returned in
<literal>*numSlots</literal>.
</para>
<para>
The data in the returned slot is used only if the <command>INSERT</command>
statement involves a view
<literal>WITH CHECK OPTION</literal>; or if the foreign table has
an <literal>AFTER ROW</literal> trigger. Triggers require all columns,
but the FDW could choose to optimize away returning some or all columns
depending on the contents of the
<literal>WITH CHECK OPTION</literal> constraints.
</para>
<para>
If the <function>ExecForeignBatchInsert</function> or
<function>GetForeignModifyBatchSize</function> pointer is set to
<literal>NULL</literal>, attempts to insert into the foreign table will
use <function>ExecForeignInsert</function>.
This function is not used if the <command>INSERT</command> has the
<literal>RETURNING</literal> clause.
</para>
<para>
Note that this function is also called when inserting routed tuples into
a foreign-table partition or executing <command>COPY FROM</command> on
a