diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 6f1166b7039..e230329a452 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -6145,8 +6145,10 @@ make_modifytable(PlannerInfo *root, } /* - * If the target foreign table has any row-level triggers, we can't - * modify the foreign table directly. + * Try to modify the foreign table directly if (1) the FDW provides + * callback functions needed for that, (2) there are no row-level + * triggers on the foreign table, and (3) there are no WITH CHECK + * OPTIONs from parent views. */ direct_modify = false; if (fdwroutine != NULL && @@ -6154,6 +6156,7 @@ make_modifytable(PlannerInfo *root, fdwroutine->BeginDirectModify != NULL && fdwroutine->IterateDirectModify != NULL && fdwroutine->EndDirectModify != NULL && + withCheckOptionLists == NIL && !has_row_triggers(root, rti, operation)) direct_modify = fdwroutine->PlanDirectModify(root, node, rti, i); if (direct_modify) |