diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 379fc5c..b4b2705 100644
*** a/src/backend/commands/explain.c
--- b/src/backend/commands/explain.c
*************** void
*** 574,580 ****
  ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc)
  {
  	Bitmapset  *rels_used = NULL;
- 	PlanState  *ps;
  
  	Assert(queryDesc->plannedstmt != NULL);
  	es->pstmt = queryDesc->plannedstmt;
--- 574,579 ----
*************** ExplainPrintPlan(ExplainState *es, Query
*** 583,599 ****
  	es->rtable_names = select_rtable_names_for_explain(es->rtable, rels_used);
  	es->deparse_cxt = deparse_context_for_plan_rtable(es->rtable,
  													  es->rtable_names);
! 
! 	/*
! 	 * Sometimes we mark a Gather node as "invisible", which means that it's
! 	 * not displayed in EXPLAIN output.  The purpose of this is to allow
! 	 * running regression tests with force_parallel_mode=regress to get the
! 	 * same results as running the same tests with force_parallel_mode=off.
! 	 */
! 	ps = queryDesc->planstate;
! 	if (IsA(ps, GatherState) &&((Gather *) ps->plan)->invisible)
! 		ps = outerPlanState(ps);
! 	ExplainNode(ps, NIL, NULL, NULL, es);
  }
  
  /*
--- 582,588 ----
  	es->rtable_names = select_rtable_names_for_explain(es->rtable, rels_used);
  	es->deparse_cxt = deparse_context_for_plan_rtable(es->rtable,
  													  es->rtable_names);
! 	ExplainNode(queryDesc->planstate, NIL, NULL, NULL, es);
  }
  
  /*
*************** ExplainNode(PlanState *planstate, List *
*** 812,817 ****
--- 801,831 ----
  	int			save_indent = es->indent;
  	bool		haschildren;
  
+ 	/*
+ 	 * In force_parallel_mode = regress mode, we want to hide Gather nodes,
+ 	 * and just show their children.  But don't do that in EXPLAIN ANALYZE,
+ 	 * nor if any initplans or subplans got attached to the Gather, as
+ 	 * omitting the Gather would produce inconsistent results then.
+ 	 */
+ 	if (force_parallel_mode == FORCE_PARALLEL_REGRESS &&
+ 		!es->analyze &&
+ 		IsA(plan, Gather) &&
+ 		planstate->initPlan == NULL &&
+ 		planstate->subPlan == NULL)
+ 	{
+ 		/* keep contrib/auto_explain happy, per comments below */
+ 		if (planstate->instrument)
+ 			InstrEndLoop(planstate->instrument);
+ 		/* adjust ancestor list properly for recursion */
+ 		ancestors = lcons(planstate, ancestors);
+ 		/* recurse, passing down same relationship/plan_name */
+ 		ExplainNode(outerPlanState(planstate), ancestors,
+ 					relationship, plan_name, es);
+ 		/* undo destructive change to ancestor list */
+ 		ancestors = list_delete_first(ancestors);
+ 		return;
+ 	}
+ 
  	switch (nodeTag(plan))
  	{
  		case T_Result:
*************** ExplainNode(PlanState *planstate, List *
*** 1032,1038 ****
  			appendStringInfoString(es->str, "->  ");
  			es->indent += 2;
  		}
! 		if (plan->parallel_aware)
  			appendStringInfoString(es->str, "Parallel ");
  		appendStringInfoString(es->str, pname);
  		es->indent++;
--- 1046,1053 ----
  			appendStringInfoString(es->str, "->  ");
  			es->indent += 2;
  		}
! 		if (plan->parallel_aware &&
! 			force_parallel_mode != FORCE_PARALLEL_REGRESS)
  			appendStringInfoString(es->str, "Parallel ");
  		appendStringInfoString(es->str, pname);
  		es->indent++;
