diff --git a/contrib/pg_upgrade/controldata.c b/contrib/pg_upgrade/controldata.c
index aef830882cdfbeca91567f38d963bd7d8c5c7a73..a480e3c7da1655f2018669641160ff3c2111184f 100644
--- a/contrib/pg_upgrade/controldata.c
+++ b/contrib/pg_upgrade/controldata.c
@@ -117,7 +117,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
 	if (!live_check || cluster == &new_cluster)
 	{
 		/* only pg_controldata outputs the cluster state */
-		snprintf(cmd, sizeof(cmd), "\"%s/pg_controldata\" \"%s\"",
+		snprintf(cmd, sizeof(cmd), SYSTEMQUOTE "\"%s/pg_controldata\" \"%s\"" SYSTEMQUOTE,
 				 cluster->bindir, cluster->pgdata);
 		fflush(stdout);
 		fflush(stderr);