aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 6d5ac6c8564..7aaa3fb802f 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -1952,9 +1952,13 @@ RelationClearRelation(Relation relation, bool rebuild)
newrel = RelationBuildDesc(save_relid, false);
if (newrel == NULL)
{
- /* Should only get here if relation was deleted */
- RelationCacheDelete(relation);
- RelationDestroyRelation(relation);
+ /*
+ * This shouldn't happen as dropping a relation is intended to be
+ * impossible if still referenced (c.f. CheckTableNotInUse()). But
+ * if we get here anyway, we can't just delete the relcache entry,
+ * as it possibly could get accessed later (as e.g. the error
+ * might get trapped and handled via a subtransaction rollback).
+ */
elog(ERROR, "relation %u deleted while still in use", save_relid);
}