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:46:42 +0000 (11:16 +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 21c4f64fd13d527dcda6cce53a6be1b50d2852dc..5df1328cba3ff5c3939633fabfaedb6e0c2618e6 100644 (file)
@@ -1900,6 +1900,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;
 
        /* Set up deparsing context */
        context = set_deparse_context_planstate(es->deparse_cxt,
index bd4072ddf602f4ba9e1a913010f0eb116daf07c4..5fac20e69c7d34632a1268c370647b2614b27a9e 100644 (file)
@@ -1133,12 +1133,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