job_queue
pg_job_queue · Proof-of-concept database-side asynchronous job queue using dynamic PostgreSQL background workers.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100339 | job_queue | pg_job_queue | 1.0 | FEAT | Unknown | C |
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
job_queue is an archived proof of concept that starts a dynamic background worker after a statement inserts into jobs_queue. The worker claims one row with FOR UPDATE SKIP LOCKED, deletes it, and executes the stored proc text with its optional JSON args.
This is not a safe production queue. proc is concatenated into SQL rather than resolved as a typed procedure, and arbitrary writers can therefore execute SQL with the worker’s database privileges. Revoke table and launch-function access from PUBLIC and do not expose either field to untrusted input.
The dequeue, deletion, and job body run in one worker transaction, but the implementation has an explicit unfinished error path: an exception from the job is not caught to update error_count or last_error. The source transaction only registers the worker; it does not wait for job success, and worker registration can fail when dynamic worker slots are exhausted.
Use a maintained queue with explicit retry, dead-letter, observability, cancellation, idempotency, and privilege semantics. Keep this extension to disposable PostgreSQL-background-worker experiments.