diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2020-03-10 08:42:59 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2020-03-10 09:09:32 +0100 |
commit | 17b9e7f9fe238eeb5f6b40061b444ebf28d9e06f (patch) | |
tree | 7c6f8d87b72708aeeb5f800ec6384cc19c927b63 /doc/src | |
parent | 61d7c7bce3686ec02bd64abac742dd35ed9b9b01 (diff) | |
download | postgresql-17b9e7f9fe238eeb5f6b40061b444ebf28d9e06f.tar.gz postgresql-17b9e7f9fe238eeb5f6b40061b444ebf28d9e06f.zip |
Support adding partitioned tables to publication
When a partitioned table is added to a publication, changes of all of
its partitions (current or future) are published via that publication.
This change only affects which tables a publication considers as its
members. The receiving side still sees the data coming from the
individual leaf partitions. So existing restrictions that partition
hierarchies can only be replicated one-to-one are not changed by this.
Author: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/logical-replication.sgml | 17 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_publication.sgml | 19 |
2 files changed, 24 insertions, 12 deletions
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index f657d1d06e0..8bd7c9c8ac0 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -402,13 +402,16 @@ <listitem> <para> - Replication is only possible from base tables to base tables. That is, - the tables on the publication and on the subscription side must be normal - tables, not views, materialized views, partition root tables, or foreign - tables. In the case of partitions, you can therefore replicate a - partition hierarchy one-to-one, but you cannot currently replicate to a - differently partitioned setup. Attempts to replicate tables other than - base tables will result in an error. + Replication is only supported by tables, partitioned or not, although a + given table must either be partitioned on both servers or not partitioned + at all. Also, when replicating between partitioned tables, the actual + replication occurs between leaf partitions, so partitions on the two + servers must match one-to-one. + </para> + + <para> + Attempts to replicate other types of relations such as views, materialized + views, or foreign tables, will result in an error. </para> </listitem> </itemizedlist> diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml index 99f87ca3938..597cb28f339 100644 --- a/doc/src/sgml/ref/create_publication.sgml +++ b/doc/src/sgml/ref/create_publication.sgml @@ -69,14 +69,23 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable> specified, the table and all its descendant tables (if any) are added. Optionally, <literal>*</literal> can be specified after the table name to explicitly indicate that descendant tables are included. + This does not apply to a partitioned table, however. The partitions of + a partitioned table are always implicitly considered part of the + publication, so they are never explicitly added to the publication. </para> <para> - Only persistent base tables can be part of a publication. Temporary - tables, unlogged tables, foreign tables, materialized views, regular - views, and partitioned tables cannot be part of a publication. To - replicate a partitioned table, add the individual partitions to the - publication. + Only persistent base tables and partitioned tables can be part of a + publication. Temporary tables, unlogged tables, foreign tables, + materialized views, and regular views cannot be part of a publication. + </para> + + <para> + When a partitioned table is added to a publication, all of its existing + and future partitions are implicitly considered to be part of the + publication. So, even operations that are performed directly on a + partition are also published via publications that its ancestors are + part of. </para> </listitem> </varlistentry> |