de-deduplicate code in DML execution hooks in postgres_fdw

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: de-deduplicate code in DML execution hooks in postgres_fdw
Date: 2018-04-18 10:34:17
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

While working on a fix related to non-direct DML [1], I noticed that
postgresExecForeignInsert(), postgresExecForeignUpdate() and
postgresExecForeignDelete() functions are almost identical except that
postgresExecForeignInsert() doesn't require ctid. The fix that I was
working is applicable to Delete and Update but can be useful for
Insert as well. I had to add the same code to two places at least and
might have missed fixing one of them. Why don't we have a single
function which prepares the statement, extract parameters, executes
the prepared statement and checks for the results, returned rows etc?
It's been a while that these functions are there and haven't produced
code which is a lot different for each of these cases. Here's a patch
to extract that code into a separate function and use it in all the
three hook implementations.


Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

Attachment Content-Type Size
Refactor-postgres_fdw-s-DML-execution-hook-functions.patch text/x-patch 7.9 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2018-04-18 10:36:38 Re: Built-in connection pooling
Previous Message Amit Langote 2018-04-18 10:27:16 Re: Boolean partitions syntax