diff -rpcd a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
*** a/src/backend/commands/tablespace.c	2014-03-21 05:17:03.000000000 +0900
--- b/src/backend/commands/tablespace.c	2014-03-25 20:58:11.758000000 +0900
*************** create_tablespace_directories(const char
*** 559,564 ****
--- 559,565 ----
  {
  	char	   *linkloc;
  	char	   *location_with_version_dir;
+ 	struct stat st;
  
  	linkloc = psprintf("pg_tblspc/%u", tablespaceoid);
  	location_with_version_dir = psprintf("%s/%s", location,
*************** create_tablespace_directories(const char
*** 585,592 ****
  
  	if (InRecovery)
  	{
- 		struct stat st;
- 
  		/*
  		 * Our theory for replaying a CREATE is to forcibly drop the target
  		 * subdirectory if present, and then recreate it. This may be more
--- 586,591 ----
*************** create_tablespace_directories(const char
*** 620,633 ****
  							location_with_version_dir)));
  	}
  
! 	/* Remove old symlink in recovery, in case it points to the wrong place */
  	if (InRecovery)
  	{
! 		if (unlink(linkloc) < 0 && errno != ENOENT)
! 			ereport(ERROR,
! 					(errcode_for_file_access(),
! 					 errmsg("could not remove symbolic link \"%s\": %m",
! 							linkloc)));
  	}
  
  	/*
--- 619,646 ----
  							location_with_version_dir)));
  	}
  
! 	/*
! 	 * Remove old symlink in recovery, in case it points to the wrong place.
! 	 * On Windows, lstat() reports junction points as directories.
! 	 */
  	if (InRecovery)
  	{
! 		if (lstat(linkloc, &st) == 0 && S_ISDIR(st.st_mode))
! 		{
! 			if (rmdir(linkloc) < 0)
! 				ereport(ERROR,
! 						(errcode_for_file_access(),
! 						 errmsg("could not remove directory \"%s\": %m",
! 								linkloc)));
! 		}
! 		else
! 		{
! 			if (unlink(linkloc) < 0 && errno != ENOENT)
! 				ereport(ERROR,
! 						(errcode_for_file_access(),
! 						 errmsg("could not remove symbolic link \"%s\": %m",
! 								linkloc)));
! 		}
  	}
  
  	/*
