Do not try to show targetlist of a RemoteSubplan on top of ModifyTable
authorPavan Deolasee <[email protected]>
Mon, 7 May 2018 04:54:21 +0000 (10:24 +0530)
committerPavan Deolasee <[email protected]>
Mon, 7 May 2018 05:47:09 +0000 (11:17 +0530)
We do some special processing for RemoteSubplan with returning lists. But the
EXPLAIN plan mechanism is not adequetly trained to handle that special
crafting. So for now do not try to print the target list in the EXPLAIN output.

src/backend/commands/explain.c
src/test/regress/expected/updatable_views.out

index 597e47f53ac83988677eaeca497d74a3e1e66303..69dc8d0508c18acd88fd688ad552e40204240581 100644 (file)
@@ -1965,6 +1965,11 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es)
                return;
        if (IsA(plan, RecursiveUnion))
                return;
+       /* Ditto for RemoteSubplan on top of ModifyTable */
+       if (IsA(plan, RemoteSubplan) && plan->lefttree &&
+               IsA(plan->lefttree, ModifyTable) &&
+               (((ModifyTable *) plan->lefttree)->returningLists != NIL))
+               return;
 
        /*
         * Likewise for ForeignScan that executes a direct INSERT/UPDATE/DELETE
index 1ce6c536c4f055e8d1e7a071a227168f02ca3135..5a315715f195a37a4e5dd9e91b05de0c22d3f76e 100644 (file)
@@ -1132,12 +1132,11 @@ EXPLAIN (verbose, costs off, nodes off) UPDATE rw_view1 SET b = b + 1 RETURNING
                             QUERY PLAN                             
 -------------------------------------------------------------------
  Remote Subquery Scan on any
-   Output: base_tbl.a, base_tbl.b
    ->  Update on public.base_tbl
          Output: base_tbl.a, base_tbl.b
          ->  Seq Scan on public.base_tbl
                Output: base_tbl.a, (base_tbl.b + 1), base_tbl.ctid
-(6 rows)
+(5 rows)
 
 UPDATE rw_view1 SET b = b + 1 RETURNING *;
  a | b