On Mon, Nov 25, 2019 at 6:37 PM Amit Langote <amitlangote09@gmail.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