diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmds.c
index e7891a4418..b3131ab208 100644
--- a/src/backend/commands/dropcmds.c
+++ b/src/backend/commands/dropcmds.c
@@ -101,21 +101,6 @@ RemoveObjects(DropStmt *stmt)
 						 errhint("Use DROP AGGREGATE to drop aggregate functions.")));
 		}
 
-		/*
-		 * Prevent the drop of a temporary schema, be it owned by the current
-		 * session or another backend as this would mess up with the callback
-		 * registered to clean up temporary objects at the end of a session.
-		 * Note also that the creation of any follow-up temporary object would
-		 * result in inconsistencies within the session whose temporary schema
-		 * has been dropped.
-		 */
-		if (stmt->removeType == OBJECT_SCHEMA &&
-			isAnyTempNamespace(address.objectId))
-			ereport(ERROR,
-					(errcode(ERRCODE_WRONG_OBJECT_TYPE),
-					 errmsg("cannot drop temporary schema \"%s\"",
-							get_namespace_name(address.objectId))));
-
 		/* Check permissions. */
 		namespaceId = get_object_namespace(&address);
 		if (!OidIsValid(namespaceId) ||
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index f0e40e36af..f6afe4dbb8 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2250,11 +2250,22 @@ do_autovacuum(void)
 		}
 
 		/* OK, let's delete it */
-		ereport(LOG,
-				(errmsg("autovacuum: dropping orphan temp table \"%s.%s.%s\"",
-						get_database_name(MyDatabaseId),
-						get_namespace_name(classForm->relnamespace),
-						NameStr(classForm->relname))));
+		if (log_min_messages <= LOG)
+		{
+			char       *nspname = get_namespace_name(classForm->relnamespace);
+
+			if (nspname != NULL)
+				ereport(LOG,
+						(errmsg("autovacuum: dropping orphan temp table \"%s.%s.%s\"",
+								get_database_name(MyDatabaseId),
+								get_namespace_name(classForm->relnamespace),
+								NameStr(classForm->relname))));
+			else
+				ereport(LOG,
+						(errmsg("autovacuum: dropping orphan temp table \"%s.(null).%s\" with OID %u",
+								get_database_name(MyDatabaseId),
+								NameStr(classForm->relname), relid)));
+		}
 
 		object.classId = RelationRelationId;
 		object.objectId = relid;
