Index: src/backend/commands/tablespace.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/tablespace.c,v
retrieving revision 1.74
diff -c -c -r1.74 tablespace.c
*** src/backend/commands/tablespace.c	26 Feb 2010 02:00:39 -0000	1.74
--- src/backend/commands/tablespace.c	30 Jun 2010 17:08:42 -0000
***************
*** 85,91 ****
  
  
  static void create_tablespace_directories(const char *location,
! 							  const Oid tablespaceoid);
  static bool destroy_tablespace_directories(Oid tablespaceoid, bool redo);
  
  
--- 85,91 ----
  
  
  static void create_tablespace_directories(const char *location,
! 					  const Oid tablespaceoid, const bool in_recovery);
  static bool destroy_tablespace_directories(Oid tablespaceoid, bool redo);
  
  
***************
*** 333,339 ****
  	/* Record dependency on owner */
  	recordDependencyOnOwner(TableSpaceRelationId, tablespaceoid, ownerId);
  
! 	create_tablespace_directories(location, tablespaceoid);
  
  	/* Record the filesystem change in XLOG */
  	{
--- 333,339 ----
  	/* Record dependency on owner */
  	recordDependencyOnOwner(TableSpaceRelationId, tablespaceoid, ownerId);
  
! 	create_tablespace_directories(location, tablespaceoid, false);
  
  	/* Record the filesystem change in XLOG */
  	{
***************
*** 533,539 ****
   *	to the specified directory
   */
  static void
! create_tablespace_directories(const char *location, const Oid tablespaceoid)
  {
  	char	   *linkloc = palloc(OIDCHARS + OIDCHARS + 1);
  	char	   *location_with_version_dir = palloc(strlen(location) + 1 +
--- 533,540 ----
   *	to the specified directory
   */
  static void
! create_tablespace_directories(const char *location, const Oid tablespaceoid,
! 							  const bool in_recovery)
  {
  	char	   *linkloc = palloc(OIDCHARS + OIDCHARS + 1);
  	char	   *location_with_version_dir = palloc(strlen(location) + 1 +
***************
*** 550,559 ****
  	if (chmod(location, 0700) != 0)
  	{
  		if (errno == ENOENT)
! 			ereport(ERROR,
! 					(errcode(ERRCODE_UNDEFINED_FILE),
! 					 errmsg("directory \"%s\" does not exist",
! 							location)));
  		else
  			ereport(ERROR,
  					(errcode_for_file_access(),
--- 551,568 ----
  	if (chmod(location, 0700) != 0)
  	{
  		if (errno == ENOENT)
! 		{
! 			if (!in_recovery)
! 				ereport(ERROR,
! 						(errcode(ERRCODE_UNDEFINED_FILE),
! 						 errmsg("directory \"%s\" does not exist", location)));
! 			else
! 				ereport(ERROR,
! 						(errcode(ERRCODE_UNDEFINED_FILE),
! 						 errmsg("directory \"%s\" does not exist", location),
! 						 errhint("create \"%s\" directory for tablespace before "
! 								 "restarting the server", location)));
! 		}
  		else
  			ereport(ERROR,
  					(errcode_for_file_access(),
***************
*** 1359,1365 ****
  		xl_tblspc_create_rec *xlrec = (xl_tblspc_create_rec *) XLogRecGetData(record);
  		char	   *location = xlrec->ts_path;
  
! 		create_tablespace_directories(location, xlrec->ts_id);
  	}
  	else if (info == XLOG_TBLSPC_DROP)
  	{
--- 1368,1374 ----
  		xl_tblspc_create_rec *xlrec = (xl_tblspc_create_rec *) XLogRecGetData(record);
  		char	   *location = xlrec->ts_path;
  
! 		create_tablespace_directories(location, xlrec->ts_id, true);
  	}
  	else if (info == XLOG_TBLSPC_DROP)
  	{
