Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8e3e67

Browse files
committed
Fix error with CREATE PUBLICATION, wal_level=minimal, and new tables.
CREATE PUBLICATION has failed spuriously when applied to a permanentrelation created or rewritten in the current transaction. Make the samechange to another site having the same semantic intent; the secondinstance has no user-visible consequences. Back-patch to v13, wherecommitc6b9204 broke this.Kyotaro HoriguchiDiscussion:https://postgr.es/m/20210113.160705.2225256954956139776.horikyota.ntt@gmail.com
1 parent86a5b30 commite8e3e67

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

‎src/backend/catalog/pg_publication.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ check_publication_add_relation(Relation targetrel)
6767
errdetail("System tables cannot be added to publications.")));
6868

6969
/* UNLOGGED and TEMP relations cannot be part of publication. */
70-
if (!RelationNeedsWAL(targetrel))
70+
if (targetrel->rd_rel->relpersistence!=RELPERSISTENCE_PERMANENT)
7171
ereport(ERROR,
7272
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
7373
errmsg("table \"%s\" cannot be replicated",

‎src/backend/optimizer/util/plancat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
126126
relation=table_open(relationObjectId,NoLock);
127127

128128
/* Temporary and unlogged relations are inaccessible during recovery. */
129-
if (!RelationNeedsWAL(relation)&&RecoveryInProgress())
129+
if (relation->rd_rel->relpersistence!=RELPERSISTENCE_PERMANENT&&
130+
RecoveryInProgress())
130131
ereport(ERROR,
131132
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
132133
errmsg("cannot access temporary or unlogged relations during recovery")));

‎src/test/subscription/t/001_rep_changes.pl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use warnings;
44
use PostgresNode;
55
use TestLib;
6-
use Test::Moretests=>23;
6+
use Test::Moretests=>24;
77

88
# Initialize publisher node
99
my$node_publisher = get_new_node('publisher');
@@ -358,3 +358,21 @@
358358

359359
$node_subscriber->stop('fast');
360360
$node_publisher->stop('fast');
361+
362+
# CREATE PUBLICATION while wal_level=minimal should succeed, with a WARNING
363+
$node_publisher->append_conf(
364+
'postgresql.conf',qq(
365+
wal_level=minimal
366+
max_wal_senders=0
367+
));
368+
$node_publisher->start;
369+
($result,my$retout,my$reterr) =$node_publisher->psql(
370+
'postgres',qq{
371+
BEGIN;
372+
CREATE TABLE skip_wal();
373+
CREATE PUBLICATION tap_pub2 FOR TABLE skip_wal;
374+
ROLLBACK;
375+
});
376+
ok($reterr =~
377+
m/WARNING: wal_level is insufficient to publish logical changes/,
378+
'CREATE PUBLICATION while wal_level=minimal');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp