Re: de-deduplicate code in DML execution hooks in postgres_fdw - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: de-deduplicate code in DML execution hooks in postgres_fdw
Date
Msg-id 5C3F15E1.5070006@lab.ntt.co.jp
Whole thread Raw
In response to Re: de-deduplicate code in DML execution hooks in postgres_fdw  (Michael Paquier <michael@paquier.xyz>)
Responses Re: de-deduplicate code in DML execution hooks in postgres_fdw  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
List pgsql-hackers
Michael-san,

(2019/01/16 15:54), Michael Paquier wrote:
> On Wed, Jan 16, 2019 at 02:59:15PM +0900, Etsuro Fujita wrote:
>> (2019/01/07 20:26), Etsuro Fujita wrote:
>>> On second thought I'd like to propose another option:
>>> execute_foreign_modify because I think this would match the existing
>>> helper functions for updating foreign tables in postgres_fdw.c better,
>>> such as create_foreign_modify, prepare_foreign_modify and
>>> finish_foreign_modify. I don't really think the function name should
>>> contain "one" or "single_row". Like the names of the calling APIs (ie,
>>> ExecForeignInsert, ExecForeignUpdate and ExecForeignDelete), I think
>>> it's OK to omit such words from the function name. Here is an updated
>>> version of the patch. In addition to the naming, I tweaked the function
>>> a little bit to match other functions (mainly variable names), moved it
>>> to the place where the helper functions are defined, fiddled with some
>>> comments, and removed an extra include file that the original patch added.
>>
>> If there are no objections, I'll commit that version of the patch.
>
> I think that you could use PgFdwModifyState for the second argument of
> execute_foreign_modify instead of ResultRelInfo.

Yeah, that is another option, but my favorite would be to use 
ResultRelInfo, as in the original patch by Ashutosh, because that makes 
it possible to write postgresExecForeignInsert, 
postgresExecForeignUpdate, and postgresExecForeignDelete as a single line.

> Except of that nit,
> it looks fine to me, thanks for taking care of it.

Great!  Thanks for the review!

Best regards,
Etsuro Fujita



pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: Query with high planning time at version 11.1 compared versions10.5 and 11.0
Next
From: Alexander Kuzmenkov
Date:
Subject: Redundant filter in index scan with a bool column