Engineering Analysis · Global
Caught-up PostgreSQL rows do not prove the new primary can take writes
Before cutting over an application, rehearse writes that allocate new IDs and verify what happens to their sequences.
By Launchr Space ·
A logical-replication subscriber can answer the read queries you care about, and its open changes may have caught up. The cutover can still fail on its first write. The application depends on more than the rows that were visible during the rehearsal.
PostgreSQL's logical-replication restrictions distinguish table changes from schema changes: schema and DDL commands are not replicated automatically. The version documentation also matters for sequences. PostgreSQL 18 documents that values in identity or serial columns transfer with their rows but the sequence itself does not. Read the page for the publisher and subscriber versions you actually run instead of treating support across versions as identical.
Test identifier allocation
Write down which schema changes may happen during the migration and how both sides will receive them. Then list the application operations that allocate a fresh identifier. In an isolated target, exercise each representative write, including inserts that omit an identifier so the database generates it. Check that generated values won't collide with existing data. A useful rehearsal also includes the next planned schema change, applied in the same compatible order the team will use on the real systems.
Rehearse the cutover
The final cutover needs evidence from both sides: the source is no longer accepting application writes, the remaining changes are applied, identifier generators are in the expected state, and real application roles can complete a representative write on the destination. Decide who confirms each item and where the receipt is kept. Write down how the team would return to the old system if a destination write has already occurred. Reversing a config change alone does not move those writes back.
For example, rehearse the first two order inserts with the same role the application actually uses. Keep one table with gaps in its existing IDs so a superficial count comparison cannot pass the exercise. Capture the generated IDs, constraint results, and one related write such as an order item. A failed write belongs in the cutover checklist, not in the first production incident.