PostgreSQL 19 was released on November 19, 2026, delayed two months from the typical September schedule due to remediation work stemming from AI-reported vulnerabilities. The headline feature is the WAIT FOR LSN command, which provides "read-your-writes" consistency for applications routing reads to standby replicas. A session on a standby can now block until the replica has replayed the write-ahead log (WAL) up to a specific log sequence number (LSN) before executing a query, ensuring visibility of data just written to the primary. The workflow involves capturing the LSN after a write on the primary via pg_current_wal_insert_lsn() — for example, 0/0306EE20 — storing it client-side (such as in a signed cookie), and issuing WAIT FOR LSN '0/0306EE20' WITH (TIMEOUT '0.1s') on the standby before reading. The optional TIMEOUT clause raises an error if the replica fails to catch up within the specified interval. This pattern mirrors the approach long used by MediaWiki with MySQL replication, where the primary binlog position is saved in the session and subsequent requests wait for the replica to reach that position using WAIT_FOR_EXECUTED_GTID_SET() or SOURCE_POS_WAIT() to guarantee a chronologically consistent view.
Read original
simonwillison