pgsql: postgres_fdw: Account for triggers in non-direct remote UPDATE p

From: Etsuro Fujita <efujita(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: postgres_fdw: Account for triggers in non-direct remote UPDATE p
Date: 2019-06-13 09:15:59
Message-ID: E1hbLpv-0006o0-EP@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

postgres_fdw: Account for triggers in non-direct remote UPDATE planning.

Previously, in postgresPlanForeignModify, we planned an UPDATE operation
on a foreign table so that we transmit only columns that were explicitly
targets of the UPDATE, so as to avoid unnecessary data transmission, but
if there were BEFORE ROW UPDATE triggers on the foreign table, those
triggers might change values for non-target columns, in which case we
would miss sending changed values for those columns. Prevent optimizing
away transmitting all columns if there are BEFORE ROW UPDATE triggers on
the foreign table.

This is an oversight in commit 7cbe57c34 which added triggers on foreign
tables, so apply the patch all the way back to 9.4 where that came in.

Author: Shohei Mochizuki
Reviewed-by: Amit Langote
Discussion: https://postgr.es/m/201905270152.x4R1q3qi014550@toshiba.co.jp

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1a3d9f62c1d158585266200b8bbb2d7d757c4eae

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 21 ++++++++++++++++++++-
contrib/postgres_fdw/postgres_fdw.c | 19 +++++++++++++------
contrib/postgres_fdw/sql/postgres_fdw.sql | 5 +++++
3 files changed, 38 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2019-06-13 13:16:03 pgsql: doc: PG 12 relnotes: update wording on truncate/vacuum item
Previous Message Tom Lane 2019-06-13 03:05:44 pgsql: Doc: fix bogus example.