(2019/04/18 22:10), Etsuro Fujita wrote:
> Notes:
>
> * I kept all the changes in the previous patch, because otherwise
> postgres_fdw would fail to release resources for a foreign-insert
> operation created by postgresBeginForeignInsert() for a tuple-routable
> foreign table (ie, a foreign-table subplan resultrel that has been
> updated already) during postgresEndForeignInsert().
I noticed that this explanation was not right. Let me correct myself.
The reason why I kept those changes is: without those changes, we would
fail to release the resources for a foreign-update operation (ie,
fmstate) created by postgresBeginForeignModify(), replaced by the
fmstate for the foreign-insert operation, because when doing
ExecEndPlan(), we first call postgresEndForeignModify() and then call
postgresEndForeignInsert(); so, if we didn't keep those changes, we
would *mistakenly* release the fmstate for the foreign-insert operation
in postgresEndForeignModify(), and we wouldn't do anything about the
fmstate for the foreign-update operation in that function and in the
subsequent postgresEndForeignInsert().
Best regards,
Etsuro Fujita