mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Add macro RelationIsPermanent() to report relation permanence
Previously, to check relation permanence, the Relation's Form_pg_class structure member relpersistence was compared to the value RELPERSISTENCE_PERMANENT ("p"). This commit adds the macro RelationIsPermanent() and is used in appropirate places to simplify the code. This matches other RelationIs* macros. This macro will be used in more places in future cluster file encryption patches. Discussion: https://postgr.es/m/20210318153134.GH20766@tamriel.snowman.net
This commit is contained in:
@@ -126,8 +126,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
|
||||
relation = table_open(relationObjectId, NoLock);
|
||||
|
||||
/* Temporary and unlogged relations are inaccessible during recovery. */
|
||||
if (relation->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT &&
|
||||
RecoveryInProgress())
|
||||
if (!RelationIsPermanent(relation) && RecoveryInProgress())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot access temporary or unlogged relations during recovery")));
|
||||
|
Reference in New Issue
Block a user