I think the following comment for store_returning_result() in
postgres_fdw.c is not right.
/* PGresult must be released before leaving this function. */
I think PGresult should not be released before leaving this function *on
success* in that function.
(I guess the comment has been copied and pasted from that for
get_remote_estimate().)
Thanks,
Best regards,
Etsuro Fujita