diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index 430ab02a2f1bf337403294c807ef0ac7b92bcdad..b2cf29246ea451e483c4f6147b2d7ccabc948657 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -628,7 +628,7 @@
 /* #undef USE_SSL */
 
 /* Define to select SysV-style semaphores. */
-#define USE_SYSV_SEMAPHORES 1
+/* #undef USE_SYSV_SEMAPHORES */
 
 /* Define to select SysV-style shared memory. */
 #define USE_SYSV_SHARED_MEMORY 1
@@ -636,6 +636,9 @@
 /* Define to select unnamed POSIX semaphores. */
 /* #undef USE_UNNAMED_POSIX_SEMAPHORES */
 
+/* Define to select Win32-style semaphores. */
+#define USE_WIN32_SEMAPHORES
+
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */
 
diff --git a/src/include/port.h b/src/include/port.h
index b195e95c7c1aac8e743e175b7f04d7864d7a65bd..7cb5608394808d250b132d5b1082d290c6938b2f 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/port.h,v 1.92 2006/06/07 22:24:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.93 2006/06/25 00:18:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -246,10 +246,10 @@ extern bool rmtree(char *path, bool rmtopdir);
 
 /* open() replacement to allow delete of held files and passing
  * of special options. */
-extern int	win32_open(const char *, int,...);
+extern int	pgwin32_open(const char *, int,...);
 
 #ifndef FRONTEND
-#define		open(a,b,c)	win32_open(a,b,c)
+#define		open(a,b,c)	pgwin32_open(a,b,c)
 #endif
 
 #define popen(a,b) _popen(a,b)
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index bc8310a045b42c94204c007c7a61e843c8cfe5a9..20974bb4d9535ed4833d8cccadf571953e0c4976 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -1,12 +1,20 @@
 /**********************************************************************
  * plpython.c - python as a procedural language for PostgreSQL
  *
- *	$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.82 2006/06/16 18:42:23 tgl Exp $
+ *	$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.83 2006/06/25 00:18:24 momjian Exp $
  *
  *********************************************************************
  */
 
+#if defined(_MSC_VER) && defined(_DEBUG)
+/* Python uses #pragma to bring in a non-default libpython on VC++ if
+ * _DEBUG is defined */
+#undef _DEBUG
 #include <Python.h>
+#define _DEBUG
+#else
+#include <Python.h>
+#endif
 #include "postgres.h"
 
 /* system stuff */
diff --git a/src/port/open.c b/src/port/open.c
index f0de771e8bb0820baa53bd5c7b62f8d8faa7fe1f..4df74d8b51b8f514353eccba45a910b851a00e52 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -6,7 +6,7 @@
  *
  * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/port/open.c,v 1.12 2006/03/05 15:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/open.c,v 1.13 2006/06/25 00:18:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,7 +19,7 @@
 #include <fcntl.h>
 #include <assert.h>
 
-int			win32_open(const char *fileName, int fileFlags,...);
+int			pgwin32_open(const char *fileName, int fileFlags,...);
 
 static int
 openFlagsToCreateFileFlags(int openFlags)
@@ -54,7 +54,7 @@ openFlagsToCreateFileFlags(int openFlags)
  *	 - handle other flags? (eg FILE_FLAG_NO_BUFFERING/FILE_FLAG_WRITE_THROUGH)
  */
 int
-win32_open(const char *fileName, int fileFlags,...)
+pgwin32_open(const char *fileName, int fileFlags,...)
 {
 	int			fd;
 	HANDLE		h;