diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-06-07 22:12:44 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-06-07 22:17:08 -0400 |
commit | 16925c1e1fa236e4d7d6c8b571890e7c777f75d7 (patch) | |
tree | 35280775c8d6fcdd1ce5cdc066f189ef0889c876 | |
parent | 135a507991c8ea9eca201cc084294a689ca24ba9 (diff) | |
download | postgresql-16925c1e1fa236e4d7d6c8b571890e7c777f75d7.tar.gz |
Complain politely about access temp/unlogged tables during recovery.
This has never been supported, but we previously let md.c issue the
complaint for us at whatever point we tried to examine the backing file.
Now we print a nicer error message.
Per bug #6041, reported by Emanuel, and extensive discussion with Tom
Lane over where to put the check.
-rw-r--r-- | src/backend/optimizer/util/plancat.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index fd8ea45b4a..b28681630b 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -90,6 +90,12 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, */ relation = heap_open(relationObjectId, NoLock); + /* Temporary and unlogged relations are inaccessible during recovery. */ + if (!RelationNeedsWAL(relation) && RecoveryInProgress()) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot access temporary or unlogged relations during recovery"))); + rel->min_attr = FirstLowInvalidHeapAttributeNumber + 1; rel->max_attr = RelationGetNumberOfAttributes(relation); rel->reltablespace = RelationGetForm(relation)->reltablespace; |