github vibhorkum/pg_background v1.9.3
pg_background v1.9.3 - SQLSTATE Propagation Fix

17 hours ago

This patch release fixes worker error reporting and hardens the worker error-exit path. No extension version bump is required — the control file remains at 1.9 and there is no upgrade SQL to run.

Bug Fixes

  • Propagate real SQLSTATE from worker to launcher via shm_mq. Previously, the launcher saw a generic SQLSTATE for worker-side errors; the actual code is now forwarded so callers can branch on specific PostgreSQL error codes.
  • Switch memory context before CopyErrorData in the worker error handler to avoid copying out of a context that is about to be torn down.
  • Use QueryCancelPending instead of ProcDiePending in the SIGTERM handler, preventing the worker from crashing on cancel.
  • Fix PG18-incompatible forward declarations that broke the build on PostgreSQL 18.
  • Fix HOLD_INTERRUPTS / pq_flush ordering and stats accounting in the error-exit path so stats stay consistent on failures.

Code Quality

  • Extract an error-exit helper and flatten nested PG_TRY to eliminate -Wshadow=compatible-local warnings.
  • NULL-safe SQLSTATE asserts, formatting, and doc cleanups.
  • Restore exact stats counts in the final regression assertion.
  • Update stale init-phase wording in worker error-exit comments.

Compatibility

  • Supported: PostgreSQL 14, 15, 16, 17, 18.
  • Extension version unchanged (1.9) — no ALTER EXTENSION ... UPDATE needed when upgrading from v1.9, v1.9.1, or v1.9.2.

Upgrade

Rebuild and reinstall the extension binary; no SQL migration is required.

```bash
make clean && make
sudo make install
```

Full Changelog: v1.9.2...v1.9.3

Don't miss a new pg_background release

NewReleases is sending notifications on new releases.