I have a regular table transactions
with 200 million rows.
I decided to convert this table to a Declarative Partition using Logical Replication.
I created a Publication on node1 like so:
CREATE PUBLICATION transactions_pub FOR TABLE transactions;
When I try to create Subscription on node2 as below:
CREATE SUBSCRIPTION transactions_sub CONNECTION 'host=x.x.x.x port=5432 password=123456 user=replicator dbname=mydbname' PUBLICATION transactions_pub;
Returns this error:
ERROR: logical replication target relation "public.transactions" is not a table
Is it possible to replicate a regular table to a Declarative Partition Table using Logical Replication?
Declarative Partitioning. PostgreSQL allows you to declare that a table is divided into partitions. The table that is divided is referred to as a partitioned table. The declaration includes the partitioning method as described above, plus a list of columns or expressions to be used as the partition key.
Logical replication is a method of replicating data objects and their changes, based upon their replication identity (usually a primary key). We use the term logical in contrast to physical replication, which uses exact block addresses and byte-by-byte replication.
Replication is supported between partitioned tables as long as they use the same partitioning scheme and otherwise have the same structure except where an exception is specifically allowed (see Section 16.4. 1.10, “Replication with Differing Table Definitions on Source and Replica”).
No, logical replication cannot replicate from and to declarative partitioned tables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With