diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 7d4f50fea7451f9fdecc4c36721f461d399da7b7..d88118168eb71e9024af1d856d14ad6b099a4e5c 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.40 2008/01/01 19:46:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.41 2008/01/19 17:43:42 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -102,10 +102,8 @@ static int	success_count = 0;
 static int	fail_count = 0;
 static int	fail_ignore_count = 0;
 
-static bool
-			directory_exists(const char *dir);
-static void
-			make_directory(const char *dir);
+static bool directory_exists(const char *dir);
+static void make_directory(const char *dir);
 
 static void
 header(const char *fmt,...)
@@ -453,11 +451,23 @@ convert_sourcefiles_in(char *source, char *dest, char *suffix)
 			*c = '/';
 #endif
 
-	/* try to create the test tablespace dir if it doesn't exist */
 	snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", abs_builddir);
+
+#ifdef WIN32
+	/*
+	 * On Windows only, clean out the test tablespace dir, or create it if it
+	 * doesn't exist.  On other platforms we expect the Makefile to take
+	 * care of that.  (We don't migrate that functionality in here because
+	 * it'd be harder to cope with platform-specific issues such as SELinux.)
+	 *
+	 * XXX it would be better if pg_regress.c had nothing at all to do with
+	 * testtablespace, and this were handled by a .BAT file or similar on
+	 * Windows.  See pgsql-hackers discussion of 2008-01-18.
+	 */
 	if (directory_exists(testtablespace))
 		rmtree(testtablespace, true);
 	make_directory(testtablespace);
+#endif
 
 	/* finally loop on each file and do the replacement */
 	for (name = names; *name; name++)