Cookbook recipe

Logical replication: publication and subscription setup

Applies to PostgreSQL 13–17 Last reviewed May 2026 Grounded in source
Estimated investigation4 min

Scenario

You need to replicate specific tables to another major version or a different schema. Logical replication moves row changes, not raw WAL blocks. Diagnose it Set wal_level and create a publication: -- publisher (wal_level=logical) CREATE PUBLICATION…

Investigation Path

You need to replicate specific tables to another major version or a different schema. Logical replication moves row changes, not raw WAL blocks.

Diagnose it

Set wal_level and create a publication:

-- publisher (wal_level=logical)
CREATE PUBLICATION pub_orders FOR TABLE orders, customers;
-- subscriber
CREATE SUBSCRIPTION sub_orders
  CONNECTION 'host=pub dbname=app'
  PUBLICATION pub_orders;

Why it happens

Logical replication decodes WAL into row-level changes and applies them on the subscriber. Unlike physical replication, it works across versions and replicates a chosen subset of tables.

This is a Pro lesson

Get every Learning Pathway and cookbook recipe — grounded in PostgreSQL source code, with diagnostics, fixes, and prevention for each topic.

Continue this lesson to learn:

  • How to fix it
  • Prevent it next time
  • Related & next steps
  • All 36 Learning Pathway lessons
  • 170+ cookbook recipes
  • Source-grounded diagnostics & fixes

Secure checkout Cancel anytime Source-grounded

Career Impact

This scenario builds production judgment and operational confidence under pressure.

Open Career Dashboard →

Keep going

Related & next steps

Was this helpful?

← All cookbook recipes