Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.149
diff -c -c -r1.149 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	15 Nov 2007 21:14:41 -0000	1.149
--- src/bin/pg_dump/pg_backup_archiver.c	24 Nov 2007 17:31:07 -0000
***************
*** 245,250 ****
--- 245,265 ----
  				_selectOutputSchema(AH, te->namespace);
  				/* Drop it */
  				ahprintf(AH, "%s", te->dropStmt);
+ 				if (strcmp(te->desc, "SCHEMA") == 0)
+ 				{
+ 					/*
+ 					 * If we dropped a schema, we know we are going to be
+ 					 * creating one later so don't remember the current one
+ 					 * so we try later. The previous 'search_path' setting
+ 					 * might have failed because the schema didn't exist
+ 					 * (and now it certainly doesn't exist), so force
+ 					 * search_path to be set as part of the next operation
+ 					 * and it might succeed.
+ 					 */
+ 					if (AH->currSchema)
+ 						free(AH->currSchema);
+ 					AH->currSchema = strdup("");
+ 				}
  			}
  		}
  	}
