diff options
author | Noah Misch <noah@leadboat.com> | 2021-01-30 00:11:38 -0800 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2021-01-30 00:12:05 -0800 |
commit | e8e3e67490f593a3669c762b50b2aa3a11208654 (patch) | |
tree | fbcf2f343f2d7cac2e2f816548f90ec050eef986 /src/backend/optimizer/util/plancat.c | |
parent | 86a5b309c9330661fd2c4c46e4dc7f07cca139e1 (diff) | |
download | postgresql-e8e3e67490f593a3669c762b50b2aa3a11208654.tar.gz postgresql-e8e3e67490f593a3669c762b50b2aa3a11208654.zip |
Fix error with CREATE PUBLICATION, wal_level=minimal, and new tables.
CREATE PUBLICATION has failed spuriously when applied to a permanent
relation created or rewritten in the current transaction. Make the same
change to another site having the same semantic intent; the second
instance has no user-visible consequences. Back-patch to v13, where
commit c6b92041d38512a4176ed76ad06f713d2e6c01a8 broke this.
Kyotaro Horiguchi
Discussion: https://postgr.es/m/20210113.160705.2225256954956139776.horikyota.ntt@gmail.com
Diffstat (limited to 'src/backend/optimizer/util/plancat.c')
-rw-r--r-- | src/backend/optimizer/util/plancat.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 3c7f3087a8b..8a0fed8ab6e 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -126,7 +126,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, relation = table_open(relationObjectId, NoLock); /* Temporary and unlogged relations are inaccessible during recovery. */ - if (!RelationNeedsWAL(relation) && RecoveryInProgress()) + if (relation->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT && + RecoveryInProgress()) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot access temporary or unlogged relations during recovery"))); |