• Etsuro Fujita's avatar
    postgres_fdw: Account for triggers in non-direct remote UPDATE planning. · 8b6da83d
    Etsuro Fujita authored
    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 7cbe57c3 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
    8b6da83d
postgres_fdw.c 196 KB