Hands-on Lab·PostgreSQL
PostgreSQL Logical Replication
Replicate one table into a writable database on another cluster. Then add a column on the publisher and watch the apply worker die while the subscription still reports itself enabled.
Replication Guide 32 of 47 Advanced
- OSUbuntu 26.04 LTS (resolute)
- PostgreSQL18.6-0ubuntu0.26.04.1
- Hostsdb-a01 / db-b01 / db-c01, 2 core / 4 GB each
- TimeAbout 21 min
- Reviewed27 August 2026
Written against the versions above. PostgreSQL 18 validates the subscription's target relations when you run `CREATE SUBSCRIPTION`, so a missing table is refused immediately. On earlier versions the subscription is created and the worker fails afterwards.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
| db-b01 | 192.168.0.82 | Ubuntu 26.04 LTS | Standby / Replica / Replica Set Member 2 | 2 Core | 4 GB | 50 GB |
| db-c01 | 192.168.0.83 | Ubuntu 26.04 LTS | Replica Set Member 3 / Cascading and Delayed Replica | 2 Core | 4 GB | 50 GB |
Before you start
- Two clusters, and a restart window on the publisher -
wal_levelneeds one. - The
replicatorrole with theREPLICATIONattribute.
-
Logical decoding needs more in the WAL than replication does
-
Publish a subset
-
The subscriber connects to a database, not to `replication`
-
The schema is not replicated either
-
Watch changes flow
-
The subscriber is writable, and that is the trap
-
Add a column, and break it
-
Tear it down properly