Re: Logical Replication WIP

From: Steve Singer <steve(at)ssinger(dot)info>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logical Replication WIP
Date: 2016-11-13 22:02:53
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/31/2016 06:38 AM, Petr Jelinek wrote:
> On 31/10/16 00:52, Steve Singer wrote:
> There are some fundamental issues with initial sync that need to be
> discussed on list but this one is not known. I'll try to convert this
> to test case (seems like useful one) and fix it, thanks for the
> report. In meantime I realized I broke the last patch in the series
> during rebase so attached is the fixed version. It also contains the
> type info in the protocol.

Attached are some proposed documentation updates (to be applied ontop of
your 20161031 patch set)


<sect1 id="logical-replication-publication">

+ <para>
+ The tables are matched using fully qualified table name. Renaming of
+ tables or schemas is not supported.
+ </para>

Is renaming of tables any less supported than other DDL operations
For example

alter table nokey2 rename to nokey3
select * FROM pg_publication_tables ;
pubname | schemaname | tablename
tpub | public | nokey3
(1 row)

If I then kill the postmaster on my subscriber and restart it, I get

2016-11-13 16:17:11.341 EST [29488] FATAL: the logical replication
target public.nokey3 not found
2016-11-13 16:17:11.342 EST [29272] LOG: worker process: logical
replication worker 41076 (PID 29488) exited with exit code 1
2016-11-13 16:17:16.350 EST [29496] LOG: logical replication apply for
subscription nokeysub started
2016-11-13 16:17:16.358 EST [29498] LOG: logical replication sync for
subscription nokeysub, table nokey2 started
2016-11-13 16:17:16.515 EST [29498] ERROR: table public.nokey2 not
found on publisher
2016-11-13 16:17:16.517 EST [29272] LOG: worker process: logical
replication worker 41076 sync 24688 (PID 29498) exited with exit code 1

but if I then rename the table on the subscriber everything seems to work.

(I suspect the need to kill+restart is a bug, I've seen other instances
where a hard restart of the subscriber following changes to is required)

I am also having issues adding a table to a publication ,it doesn't seem

P: create publication tpub for table a;
S: create subscription mysub connection 'host=localhost dbname=test
port=5440' publication tpub;
P: insert into a(b) values ('1');
P: alter publication tpub add table b;
P: insert into b(b) values ('1');
P: insert into a(b) values ('2');

select * FROM pg_publication_tables ;
pubname | schemaname | tablename
tpub | public | a
tpub | public | b


S: select * FROM b;
a | b
(0 rows)
S: select * FROM a;
a | b
5 | 1
6 | 2
(2 rows)

Attachment Content-Type Size
docupdates.diff text/x-diff 4.5 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-11-13 22:20:05 Re: ExplainOneQuery_hook ignored for EXPLAIN EXECUTE
Previous Message Tom Lane 2016-11-13 21:46:05 Re: Improving RLS planning