diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index 22d19ed7944..7150f7614f2 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -236,6 +236,11 @@
 /* Define to 1 if `long int' works and is 64 bits. */
 /* #undef HAVE_LONG_INT_64 */
 
+/* Define to 1 if the system has the type `long long int'. */
+#if (_MSC_VER > 1200)
+#define HAVE_LONG_LONG_INT 1
+#endif
+
 /* Define to 1 if `long long int' works and is 64 bits. */
 #if (_MSC_VER > 1200)
 #define HAVE_LONG_LONG_INT_64 1
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index d3b50bd4efd..36e9fd70d32 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -424,10 +424,11 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
 		  || confess "Could not open ecpg_config.h";
 		print $o <<EOF;
 #if (_MSC_VER > 1200)
+#define HAVE_LONG_LONG_INT 1
 #define HAVE_LONG_LONG_INT_64 1
+#endif
 #define ENABLE_THREAD_SAFETY 1
 EOF
-		print $o "#endif\n";
 		close($o);
 	}