Fix handling of unlogged tables in FOR ALL TABLES publications

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix handling of unlogged tables in FOR ALL TABLES publications
Date: 2019-03-13 12:03:46
Message-ID: f3f151f7-c4dd-1646-b998-f60bd6217dd3@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

If a FOR ALL TABLES publication exists, unlogged tables are ignored
for publishing changes. But CheckCmdReplicaIdentity() would still
check in that case that such a table has a replica identity set before
accepting updates. That is useless, so check first whether the given
table is publishable and skip the check if not.

Example:

CREATE PUBLICATION pub FOR ALL TABLES;
CREATE UNLOGGED TABLE logical_replication_test AS SELECT 1 AS number;
UPDATE logical_replication_test SET number = 2;
ERROR: cannot update table "logical_replication_test" because it does
not have a replica identity and publishes updates

Patch attached.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Fix-handling-of-unlogged-tables-in-FOR-ALL-TABLES-pu.patch text/plain 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-03-13 12:12:01 Re: performance issue in remove_from_unowned_list()
Previous Message Magnus Hagander 2019-03-13 12:02:04 Re: Use nanosleep(2) in pg_usleep, if available?