aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/gist/gistutil.c2
-rw-r--r--src/backend/access/heap/heapam_handler.c2
-rw-r--r--src/backend/catalog/pg_publication.c2
-rw-r--r--src/backend/commands/tablecmds.c10
-rw-r--r--src/backend/optimizer/util/plancat.c3
-rw-r--r--src/backend/utils/cache/relcache.c2
6 files changed, 10 insertions, 11 deletions
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index a3ec9f2cfe4..1ff1bf816f1 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -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
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c
index 7b475f2950c..7a9a640989a 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -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);
diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 84d2efcfd2f..86e415af892 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -67,7 +67,7 @@ check_publication_add_relation(Relation targetrel)
errdetail("System tables cannot be added to publications.")));
/* UNLOGGED and TEMP relations cannot be part of publication. */
- if (targetrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT)
+ if (!RelationIsPermanent(targetrel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("table \"%s\" cannot be replicated",
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 54fea31e43f..3349bcfaa74 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8650,13 +8650,13 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
switch (rel->rd_rel->relpersistence)
{
case RELPERSISTENCE_PERMANENT:
- if (pkrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT)
+ if (!RelationIsPermanent(pkrel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("constraints on permanent tables may reference only permanent tables")));
break;
case RELPERSISTENCE_UNLOGGED:
- if (pkrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT
+ if (!RelationIsPermanent(pkrel)
&& pkrel->rd_rel->relpersistence != RELPERSISTENCE_UNLOGGED)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
@@ -13712,7 +13712,7 @@ index_copy_data(Relation rel, 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);
@@ -15230,7 +15230,7 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
if (toLogged)
{
- if (foreignrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT)
+ if (!RelationIsPermanent(foreignrel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("could not change table \"%s\" to logged because it references unlogged table \"%s\"",
@@ -15240,7 +15240,7 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
}
else
{
- if (foreignrel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
+ if (RelationIsPermanent(foreignrel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("could not change table \"%s\" to unlogged because it references logged table \"%s\"",
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index c5947fa4185..7f2e40ae39e 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -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")));
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 20be094f460..ff7395c85b5 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -2990,7 +2990,7 @@ static void
AssertPendingSyncConsistency(Relation relation)
{
bool relcache_verdict =
- relation->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT &&
+ RelationIsPermanent(relation) &&
((relation->rd_createSubid != InvalidSubTransactionId &&
RELKIND_HAS_STORAGE(relation->rd_rel->relkind)) ||
relation->rd_firstRelfilenodeSubid != InvalidSubTransactionId);