aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 f26f976f486..1ebb37faa92 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -2192,9 +2192,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, false);
+ /*
+ * 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);
}