You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how-to/configure-postgres.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,28 @@ CREATE PUBLICATION all_tables FOR ALL TABLES;
116
116
CREATE PUBLICATION inserts_only FOR TABLE users WITH (publish ='insert');
117
117
```
118
118
119
+
#### Partitioned Tables
120
+
121
+
If you want to replicate partitioned tables, you must use `publish_via_partition_root = true` when creating your publication. This option tells Postgres to treat the [partitioned table as a single table](https://www.postgresql.org/docs/current/sql-createpublication.html#SQL-CREATEPUBLICATION-PARAMS-WITH-PUBLISH-VIA-PARTITION-ROOT) from the replication perspective, rather than replicating each partition individually. All changes to any partition will be published as changes to the parent table:
122
+
123
+
```sql
124
+
-- Create publication with partitioned table support
125
+
CREATE PUBLICATION my_publication FOR TABLE users, orders WITH (publish_via_partition_root = true);
126
+
127
+
-- For all tables including partitioned tables
128
+
CREATE PUBLICATION all_tables FOR ALL TABLES WITH (publish_via_partition_root = true);
129
+
```
130
+
131
+
**Limitation:** If this option is enabled, `TRUNCATE` operations performed directly on individual partitions are not replicated. To replicate a truncate operation, you must execute it on the parent table instead:
0 commit comments