Critical Bug Fixes
This patch release fixes two critical crash bugs that could crash the entire PostgreSQL cluster:
1. Worker crash on SQL execution error (PR #96)
Before: Workers encountering SQL errors (e.g., SELECT 1/0) would crash all database connections with:
WARNING: terminating connection because of crash of another server process
DETAIL: The postmaster has commanded this server process to roll back...
Root cause: PG_RE_THROW() at top level caused abnormal process exit, which PostgreSQL interprets as shared memory corruption.
Fix: Replace with FlushErrorState(), AbortCurrentTransaction(), and proc_exit(1) for clean exit.
2. Worker crash on cancel (PR #97)
Before: Canceling workers running long queries via cancel_v2() or cancel_all_v2() would crash all database connections.
Root cause: SIGTERM handler used ProcDiePending (FATAL error) which bypasses all error handlers.
Fix: Use QueryCancelPending (ERROR level) which is properly caught and handled.
Upgrade Recommended
All users of pg_background v1.9 should upgrade to v1.9.1.
Note: The PostgreSQL extension version remains 1.9 (no SQL changes). This is a C-only patch release.
Installation
-- If upgrading from v1.9, just reinstall the shared library
-- The extension SQL version stays at 1.9
DROP EXTENSION pg_background;
CREATE EXTENSION pg_background;