summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/postmaster/autovacuum.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 70e08b552a1..0a8fb3d58f0 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2084,13 +2084,18 @@ do_autovacuum(void)
if (classForm->relpersistence == RELPERSISTENCE_TEMP)
{
int backendID;
+ PGPROC *proc;
backendID = GetTempNamespaceBackendId(classForm->relnamespace);
- /* We just ignore it if the owning backend is still active */
+ /*
+ * We just ignore it if the owning backend is still active in the
+ * same database.
+ */
if (backendID != InvalidBackendId &&
(backendID == MyBackendId ||
- BackendIdGetProc(backendID) == NULL))
+ (proc = BackendIdGetProc(backendID)) == NULL ||
+ proc->databaseId != MyDatabaseId))
{
/*
* The table seems to be orphaned -- although it might be that