diff --git a/src/backend/utils/activity/backend_progress.c b/src/backend/utils/activity/backend_progress.c
index 0a259907d55..796ba15bebc 100644
--- a/src/backend/utils/activity/backend_progress.c
+++ b/src/backend/utils/activity/backend_progress.c
@@ -73,6 +73,7 @@ pgstat_progress_start_command(ProgressCommandType cmdtype, Oid relid)
 	volatile PgBackendStatus *beentry = MyBEEntry;
 	MemoryContext oldcxt;
 	PgBackendProgresElt *parent_new = NULL;
+	bool	is_dummy = false;
 
 	if (!beentry || !pgstat_track_activities || !pgstat_track_progress)
 		return;
@@ -104,11 +105,28 @@ pgstat_progress_start_command(ProgressCommandType cmdtype, Oid relid)
 		if (beentry->st_progress_top.command == PROGRESS_COMMAND_INVALID)
 			beentry->st_progress_top = beentry->st_progress;
 	}
+
+	/*
+	 * Now check the stack to see if a command of the same type is already
+	 * being monitored.
+	 */
+	for (PgBackendProgresElt *stack_elt = parent_commands; stack_elt != NULL;
+		 stack_elt = stack_elt->parent)
+	{
+		if (stack_elt->progress.command == cmdtype)
+		{
+			/* Cannot really monitor the new command. */
+			is_dummy = true;
+			break;
+		}
+	}
+
 	beentry->st_progress.command = cmdtype;
 	beentry->st_progress.command_target = relid;
 	for (int i = 0; i < PGSTAT_NUM_PROGRESS_PARAM; i++)
 		beentry->st_progress.param[i] = 0;
 	beentry->st_progress.xact_level = xact_level;
+	beentry->st_progress.is_dummy = is_dummy;
 	PGSTAT_END_WRITE_ACTIVITY(beentry);
 	if (parent_new)
 		pfree(parent_new);
@@ -127,7 +145,8 @@ pgstat_progress_update_param(int index, int64 val)
 
 	Assert(index >= 0 && index < PGSTAT_NUM_PROGRESS_PARAM);
 
-	if (!beentry || !pgstat_track_activities || !pgstat_track_progress)
+	if (!beentry || beentry->st_progress.is_dummy ||
+		!pgstat_track_activities || !pgstat_track_progress)
 		return;
 
 	/* Sub-commands introduce special cases that need to be tested. */
@@ -152,7 +171,8 @@ pgstat_progress_incr_param(int index, int64 incr)
 
 	Assert(index >= 0 && index < PGSTAT_NUM_PROGRESS_PARAM);
 
-	if (!beentry || !pgstat_track_activities)
+	if (!beentry || beentry->st_progress.is_dummy ||
+		!pgstat_track_activities || !pgstat_track_progress)
 		return;
 
 	PGSTAT_BEGIN_WRITE_ACTIVITY(beentry);
@@ -202,8 +222,8 @@ pgstat_progress_update_multi_param(int nparam, const int *index,
 	volatile PgBackendStatus *beentry = MyBEEntry;
 	int			i;
 
-	if (!beentry || !pgstat_track_activities || !pgstat_track_progress ||
-		nparam == 0)
+	if (!beentry || beentry->st_progress.is_dummy ||
+		!pgstat_track_activities || !pgstat_track_progress || nparam == 0)
 		return;
 
 	PGSTAT_BEGIN_WRITE_ACTIVITY(beentry);
@@ -274,6 +294,8 @@ pgstat_progress_end_command(bool xact)
 				beentry->st_progress_top.command = PROGRESS_COMMAND_INVALID;
 				beentry->st_progress_top.command_target = InvalidOid;
 				beentry->st_progress_top.xact_level = 0;
+				/* The top command should never become dummy, but be tidy. */
+				beentry->st_progress_top.is_dummy = false;
 			}
 		}
 		else
@@ -287,6 +309,8 @@ pgstat_progress_end_command(bool xact)
 				beentry->st_progress.command = PROGRESS_COMMAND_INVALID;
 				beentry->st_progress.command_target = InvalidOid;
 				beentry->st_progress.xact_level = 0;
+				/* See above. */
+				beentry->st_progress.is_dummy = false;
 			}
 
 			break;
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 3ba2f0808a8..85510a1fe77 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -383,12 +383,17 @@ pg_stat_get_progress_info(PG_FUNCTION_ARGS)
 
 		/*
 		 * Report values for only those backends which are running the given
-		 * command.
+		 * command. (Dummy entry has no data to report.)
 		 */
-		if (beentry->st_progress.command == cmdtype)
+		if (!beentry->st_progress.is_dummy &&
+			beentry->st_progress.command == cmdtype)
 			st_progress = &beentry->st_progress;
 		else if (beentry->st_progress_top.command == cmdtype)
+		{
+			Assert(!beentry->st_progress_top.is_dummy);
+
 			st_progress = &beentry->st_progress_top;
+		}
 		else
 			continue;
 
diff --git a/src/include/utils/backend_status.h b/src/include/utils/backend_status.h
index 2f511a5992e..3c79f4ba72e 100644
--- a/src/include/utils/backend_status.h
+++ b/src/include/utils/backend_status.h
@@ -96,6 +96,20 @@ typedef struct PgBackendProgress
 	Oid			command_target;
 	/* Transaction nesting level the monitoring started at. */
 	int			xact_level;
+
+	/*
+	 * If a backend tries to start monitoring of a command of and another
+	 * command of the same type is already being monitored, mark the new
+	 * command as dummy, so that it's not actually used. (We still need the
+	 * command in the stack so that pgstat_progress_end_command() works
+	 * correctly.)
+	 *
+	 * The typical scenario is COPY TO running on a table having an insert
+	 * trigger that scans a file_fdw table (which in turn runs COPY FROM). In
+	 * this case, we can only monitor the "outer" COPY TO.
+	 */
+	bool		is_dummy;
+
 	int64		param[PGSTAT_NUM_PROGRESS_PARAM];
 } PgBackendProgress;
 
