{
RelToCluster *rtc;
Form_pg_index index;
+ HeapTuple classtup;
+ Form_pg_class classForm;
MemoryContext oldcxt;
index = (Form_pg_index) GETSTRUCT(tuple);
continue;
/* Verify that the table still exists; skip if not */
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(index->indrelid)))
+ classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(index->indrelid));
+ if (!HeapTupleIsValid(classtup))
{
UnlockRelationOid(index->indrelid, AccessShareLock);
continue;
}
+ classForm = (Form_pg_class) GETSTRUCT(classtup);
+
+ /* Skip temp relations belonging to other sessions */
+ if (classForm->relpersistence == RELPERSISTENCE_TEMP &&
+ !isTempOrTempToastNamespace(classForm->relnamespace))
+ {
+ ReleaseSysCache(classtup);
+ UnlockRelationOid(index->indrelid, AccessShareLock);
+ continue;
+ }
+
+ ReleaseSysCache(classtup);
/* noisily skip rels which the user can't process */
if (!repack_is_permitted_for_relation(cmd, index->indrelid,
continue;
}
+ /* Skip temp relations belonging to other sessions */
+ if (class->relpersistence == RELPERSISTENCE_TEMP &&
+ !isTempOrTempToastNamespace(class->relnamespace))
+ {
+ UnlockRelationOid(class->oid, AccessShareLock);
+ continue;
+ }
+
/* noisily skip rels which the user can't process */
if (!repack_is_permitted_for_relation(cmd, class->oid,
GetUserId()))
classForm->relkind != RELKIND_PARTITIONED_TABLE)
continue;
+ /* Skip temp relations belonging to other sessions */
+ if (classForm->relpersistence == RELPERSISTENCE_TEMP &&
+ !isTempOrTempToastNamespace(classForm->relnamespace))
+ continue;
+
/* check permissions of relation */
if (!vacuum_is_permitted_for_relation(relid, classForm, options))
continue;