Re: adding partitioned tables to publications

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: adding partitioned tables to publications
Date: 2019-12-06 07:48:42
Message-ID: CA+HiwqGUZJYaJSM5cPKKFrFSJbTsDyJ9o4Vd=M2d7i5brKvGbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 25, 2019 at 6:37 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> OK, let's make whether to publish with root or leaf schema an option,
> with the latter being the default. I will see about updating the
> patch that way.

Here are the updated patches.

0001: Adding a partitioned table to a publication implicitly adds all
its partitions. The receiving side must have tables matching the
published partitions, which is typically the case, because the same
partition tree is defined on both nodes.

0002: Add a new Boolean publication parameter
'publish_using_root_schema'. If true, a partitioned table's
partitions are not exposed to the subscriber, that is, changes of its
partitions are published as its own. This allows to replicate
partitioned table changes to a non-partitioned table (seldom useful)
or to a partitioned table that has different set of partitions than on
the publisher (a reasonable use case). This patch only adds the
parameter and doesn't implement any of that behavior.

0003: A refactoring patch for worker.c to allow handling partitioned
tables as targets of logical of replication commands a bit easier.

0004: This implements the 'publish_using_root_schema = true' behavior
described above. (An unintended benefit of making partitioned tables
an accepted relation type in worker.c is that it allows partitions on
subscriber to be sub-partitioned even if they are not on the
publisher, that is, when replicating partition-to-partition!)

Thanks,
Amit

Attachment Content-Type Size
v6-0002-Add-publish_using_root_schema-parameter-for-publi.patch application/octet-stream 26.7 KB
v6-0001-Support-adding-partitioned-tables-to-publication.patch application/octet-stream 38.7 KB
v6-0004-Publish-partitioned-table-inserts-as-its-own.patch application/octet-stream 37.8 KB
v6-0003-Some-refactoring-of-logical-worker.c.patch application/octet-stream 13.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2019-12-06 07:57:15 Re: libpq sslpassword parameter and callback function
Previous Message Noah Misch 2019-12-06 07:33:49 Re: Windows UTF-8, non-ICU collation trouble