]> granicus.if.org Git - postgresql/commit
postgres_fdw: Account for triggers in non-direct remote UPDATE planning.
authorEtsuro Fujita <efujita@postgresql.org>
Thu, 13 Jun 2019 08:59:13 +0000 (17:59 +0900)
committerEtsuro Fujita <efujita@postgresql.org>
Thu, 13 Jun 2019 08:59:13 +0000 (17:59 +0900)
commit1ade21e7facc1202dadca4e916f4d5d3723f84b9
tree20fcc88eb1c1b77f2236cdea2fe6bc1fcbbc3e41
parent457dab1e7bc694811974a24690846de00de6b4fb
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
contrib/postgres_fdw/expected/postgres_fdw.out
contrib/postgres_fdw/postgres_fdw.c
contrib/postgres_fdw/sql/postgres_fdw.sql