diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 85b12b6eca4efcad4f4dc4be6ae3857a7ccff97d..7ede6954aa16393ce7cdea4f5a5f75d1aee30772 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -4,7 +4,7 @@
  * A simple benchmark program for PostgreSQL
  * Originally written by Tatsuo Ishii and enhanced by many contributors.
  *
- * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.87 2009/06/11 14:48:51 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.88 2009/07/30 09:28:00 mha Exp $
  * Copyright (c) 2000-2009, PostgreSQL Global Development Group
  * ALL RIGHTS RESERVED;
  *
@@ -26,6 +26,11 @@
  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  *
  */
+
+#ifdef WIN32
+#define FD_SETSIZE 1024		/* set before winsock2.h is included */
+#endif   /* ! WIN32 */
+
 #include "postgres_fe.h"
 
 #include "libpq-fe.h"
@@ -34,8 +39,6 @@
 #include <ctype.h>
 
 #ifdef WIN32
-#undef FD_SETSIZE
-#define FD_SETSIZE 1024
 #include <win32.h>
 #else
 #include <signal.h>