drop-temp-schema-adjust-v6.patch
text/x-diff
Filename: drop-temp-schema-adjust-v6.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
Series: patch v6
| File | + | − |
|---|---|---|
| src/backend/postmaster/autovacuum.c | 15 | 5 |
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index f0e40e36af..9eb8132a37 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2071,9 +2071,11 @@ do_autovacuum(void)
{
/*
* We just ignore it if the owning backend is still active and
- * using the temporary schema.
+ * using the temporary schema. If the namespace does not exist
+ * ignore the entry.
*/
- if (!isTempNamespaceInUse(classForm->relnamespace))
+ if (!isTempNamespaceInUse(classForm->relnamespace) &&
+ get_namespace_name(classForm->relnamespace) != NULL)
{
/*
* The table seems to be orphaned -- although it might be that
@@ -2202,6 +2204,7 @@ do_autovacuum(void)
Oid relid = lfirst_oid(cell);
Form_pg_class classForm;
ObjectAddress object;
+ char *nspname;
/*
* Check for user-requested abort.
@@ -2243,7 +2246,15 @@ do_autovacuum(void)
continue;
}
- if (isTempNamespaceInUse(classForm->relnamespace))
+ nspname = get_namespace_name(classForm->relnamespace);
+
+ /*
+ * Nothing to do for a relation with a missing namespace. This
+ * check is the same as above when building the list of orphan
+ * relations.
+ */
+ if (isTempNamespaceInUse(classForm->relnamespace) ||
+ nspname == NULL)
{
UnlockRelationOid(relid, AccessExclusiveLock);
continue;
@@ -2253,8 +2264,7 @@ do_autovacuum(void)
ereport(LOG,
(errmsg("autovacuum: dropping orphan temp table \"%s.%s.%s\"",
get_database_name(MyDatabaseId),
- get_namespace_name(classForm->relnamespace),
- NameStr(classForm->relname))));
+ nspname, NameStr(classForm->relname))));
object.classId = RelationRelationId;
object.objectId = relid;