diff --git a/src/backend/access/common/relation.c b/src/backend/access/common/relation.c index d8a313a2c9..7f4ab45693 100644 --- a/src/backend/access/common/relation.c +++ b/src/backend/access/common/relation.c @@ -60,6 +60,11 @@ relation_open(Oid relationId, LOCKMODE lockmode) if (!RelationIsValid(r)) elog(ERROR, "could not open relation with OID %u", relationId); + if (RELATION_IS_OTHER_TEMP(r)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot access temporary tables of other sessions"))); + /* * If we didn't get the lock ourselves, assert that caller holds one, * except in bootstrap mode where no locks are used.