diff options
-rw-r--r-- | src/backend/utils/cache/relcache.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 1ebb37faa92..24c92e791ff 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -2193,6 +2193,18 @@ RelationClearRelation(Relation relation, bool rebuild) if (newrel == NULL) { /* + * We can validly get here, if we're using a historic snapshot in + * which a relation, accessed from outside logical decoding, is + * still invisible. In that case it's fine to just mark the + * relation as invalid and return - it'll fully get reloaded by + * the cache reset at the end of logical decoding (or at the next + * access). During normal processing we don't want to ignore this + * case as it shouldn't happen there, as explained below. + */ + if (HistoricSnapshotActive()) + return; + + /* * 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, |