DROP TRIGGER trig_row_after ON rem1;
DROP TRIGGER trig_local_before ON loc1;
-- Test direct foreign table modification functionality
+EXPLAIN (verbose, costs off)
+DELETE FROM rem1; -- can be pushed down
+ QUERY PLAN
+---------------------------------------------
+ Delete on public.rem1
+ -> Foreign Delete on public.rem1
+ Remote SQL: DELETE FROM public.loc1
+(3 rows)
+
+EXPLAIN (verbose, costs off)
+DELETE FROM rem1 WHERE false; -- currently can't be pushed down
+ QUERY PLAN
+-------------------------------------------------------
+ Delete on public.rem1
+ Remote SQL: DELETE FROM public.loc1 WHERE ctid = $1
+ -> Result
+ Output: ctid
+ One-Time Filter: false
+(5 rows)
+
-- Test with statement-level triggers
CREATE TRIGGER trig_stmt_before
BEFORE DELETE OR INSERT OR UPDATE ON rem1
if (subplan_index < list_length(appendplan->appendplans))
subplan = (Plan *) list_nth(appendplan->appendplans, subplan_index);
}
- else if (IsA(subplan, Result) && IsA(outerPlan(subplan), Append))
+ else if (IsA(subplan, Result) &&
+ outerPlan(subplan) != NULL &&
+ IsA(outerPlan(subplan), Append))
{
Append *appendplan = (Append *) outerPlan(subplan);
-- Test direct foreign table modification functionality
+EXPLAIN (verbose, costs off)
+DELETE FROM rem1; -- can be pushed down
+EXPLAIN (verbose, costs off)
+DELETE FROM rem1 WHERE false; -- currently can't be pushed down
-- Test with statement-level triggers
CREATE TRIGGER trig_stmt_before