---
title: "pg_background 2.0: Run SQL in the Background, Now Cleaner, Safer, and Ready for PostgreSQL 19"
url: https://daily.dev/posts/pg-background-2-0-run-sql-in-the-background-now-cleaner-safer-and-ready-for-postgresql-19-wnrct9qqs
source_url: https://postgr.es/p/9lw
type: article
source: "Planet PostgreSQL"
published: 2026-06-08T20:51:04.132Z
updated: 2026-06-10T04:41:07.468Z
tags: ["postgresql"]
reading_time: 28
upvotes: 8
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# pg_background 2.0: Run SQL in the Background, Now Cleaner, Safer, and Ready for PostgreSQL 19

**[Planet PostgreSQL](https://daily.dev/sources/planet-postgresql)** · 28 min read · 8 upvotes · 0 comments

## Summary

pg_background 2.0 is a major release of the PostgreSQL extension that enables running SQL in independent background worker processes with their own transaction lifecycle. Key changes include: promoting clean unsuffixed API names as canonical (dropping the _v2 suffix while keeping deprecated aliases), consolidating cancellation and wait functions into single entry points with optional parameters, removing the redundant pg_background_status_v2() in favor of to_jsonb(pg_background_outcome()), improved observability with structured error info and result metadata including timing, stricter security defaults by revoking PUBLIC access and introducing a dedicated pgbackground_role, and PostgreSQL 19 beta compatibility. The release also adds convenience helpers for fan-out workloads, label-based cancellation, and worker draining. Upgrade is a single ALTER EXTENSION command, with deprecated aliases providing migration runway for existing _v2 callers.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://postgr.es/p/9lw>

## Similar posts on daily.dev

- [pg\_dbms\_job v2.0 released](https://daily.dev/posts/pg-dbms-job-v2-0-released-jznbxcmdb) · PostgreSQL · 8 upvotes · 2 comments

---

Tags: [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/pg-background-2-0-run-sql-in-the-background-now-cleaner-safer-and-ready-for-postgresql-19-wnrct9qqs)
