mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +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:
@@ -1036,7 +1036,7 @@ gistGetFakeLSN(Relation rel)
|
||||
|
||||
return counter++;
|
||||
}
|
||||
else if (rel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
|
||||
else if (RelationIsPermanent(rel))
|
||||
{
|
||||
/*
|
||||
* WAL-logging on this relation will start after commit, so its LSNs
|
||||
|
||||
@@ -662,7 +662,7 @@ heapam_relation_copy_data(Relation rel, const RelFileNode *newrnode)
|
||||
* WAL log creation if the relation is persistent, or this is the
|
||||
* init fork of an unlogged relation.
|
||||
*/
|
||||
if (rel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT ||
|
||||
if (RelationIsPermanent(rel) ||
|
||||
(rel->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED &&
|
||||
forkNum == INIT_FORKNUM))
|
||||
log_smgrcreate(newrnode, forkNum);
|
||||
|
||||
Reference in New Issue
Block a user