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:11:38 -0800 |
commit | 360bd2321b1ad9c47466bc485ee5eb2f4515372e (patch) | |
tree | f8b6d8bc82dd72abed0c8beb50b9777cb5b5762d /src/backend/optimizer/util/plancat.c | |
parent | 8a54e12a38d1545d249f1402f66c8cde2837d97c (diff) | |
download | postgresql-360bd2321b1ad9c47466bc485ee5eb2f4515372e.tar.gz postgresql-360bd2321b1ad9c47466bc485ee5eb2f4515372e.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 da322b453ea..177e6e336ab 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"))); |