diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 87b7d3bf65cd6a3513c7c607ce4b450a753ecb31..f9d673f881c1da14f9e2252817b74b4b0219bfac 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -61,6 +61,14 @@ main(int argc, char *argv[])
 {
 	bool		do_check_root = true;
 
+	/*
+	 * If supported on the current platform, set up a handler to be called if
+	 * the backend/postmaster crashes with a fatal signal or exception.
+	 */
+#if defined(WIN32) && defined(HAVE_MINIDUMP_TYPE)
+	pgwin32_install_crashdump_handler();
+#endif
+
 	progname = get_progname(argv[0]);
 
 	/*
@@ -81,14 +89,6 @@ main(int argc, char *argv[])
 	 */
 	argv = save_ps_display_args(argc, argv);
 
-	/*
-	 * If supported on the current platform, set up a handler to be called if
-	 * the backend/postmaster crashes with a fatal signal or exception.
-	 */
-#if defined(WIN32) && defined(HAVE_MINIDUMP_TYPE)
-	pgwin32_install_crashdump_handler();
-#endif
-
 	/*
 	 * Fire up essential subsystems: error and memory management
 	 *