⚠️ IMPORTANT: This release has critical crash bugs. Please use v1.9.1 instead.
New Features
Worker Labels
- Optional
labelparameter onpg_background_launch_v2()andpg_background_submit_v2() - Labels visible in
pg_background_list_v2()output - Helps identify workers in monitoring and debugging scenarios
- Maximum 64 bytes
Structured Error Returns
- New
pg_background_error_info_v2(pid, cookie)function - Returns
pg_background_errortype with:sqlstate- SQLSTATE error code (e.g., '23505')message- Primary error messagedetail- Detailed error infohint- Hint for resolutioncontext- Error context/stack trace
- Enables programmatic error handling without consuming results
Result Metadata
- New
pg_background_result_info_v2(pid, cookie)function - Returns
pg_background_result_infotype with:row_count- Number of rows affected/returnedcommand_tag- SQL command executed (SELECT, INSERT, etc.)completed- Whether execution finishedhas_error- Whether an error occurred
- Non-destructive inspection (doesn't consume results)
Batch Operations
pg_background_detach_all_v2()- Detach all tracked workerspg_background_cancel_all_v2()- Cancel all tracked workers- Returns count of affected workers
- Respects privilege model (only affects workers you launched)
PostgreSQL Compatibility
- Tested on PostgreSQL 14, 15, 16, 17, 18
- CI matrix covers Ubuntu 22.04 and 24.04
Installation
-- Fresh install
CREATE EXTENSION pg_background;
-- Upgrade from 1.8
ALTER EXTENSION pg_background UPDATE TO '1.9';