Re: Logical replication and inheritance

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logical replication and inheritance
Date: 2017-04-17 03:00:50
Message-ID: bac36711-4694-723a-8651-7315d04d6c21@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/04/15 3:53, Peter Eisentraut wrote:
> On 4/13/17 06:48, Amit Langote wrote:
>> That is an important consideration because of pg_dump. See below:
>>
>> create table foo (a int);
>> create table bar () inherits (foo);
>> create publication mypub for table foo; -- bar is added too.
>>
>> $ pg_dump -s | psql -e test
>> <snip>
>> ALTER PUBLICATION mypub ADD TABLE foo;
>> ERROR: relation "bar" is already member of publication "mypub"
>
> To fix this, pg_dump should emit ADD TABLE ONLY foo.

Yeah, that's one way. Attached is a tiny patch for that.

By the way, I noticed that although grammar accepts ONLY and * against a
table name to affect whether descendant tables are included, the same is
not mentioned in the CREATE PUBLICATION and ALTER PUBLICATION reference
pages. I suspect it was probably not intentional, so attached a doc patch
for that too.

Thanks,
Amit

Attachment Content-Type Size
0001-Make-pg_dump-emit-ONLY-before-table-added-to-publica.patch text/x-diff 2.4 KB
0002-Document-that-ONLY-can-be-specified-in-publication-c.patch text/x-diff 3.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-04-17 03:58:12 Re: Shouldn't duplicate addition to publication be a no-op?
Previous Message Masahiko Sawada 2017-04-17 02:40:28 Re: Logical replication launcher uses wal_retrieve_retry_interval