pg_dbms_job
pg_dbms_job · Extension to add Oracle DBMS_JOB full compatibility to PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9260 | pg_dbms_job | pg_dbms_job | 2.1.0 | SIM | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | dbms_job |
| See Also | pg_cron pg_task pgagent pg_dispatch pg_later pg_dbms_metadata pg_dbms_lock pg_dbms_errlog orafce pg_utl_smtp |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 |
| el8.aarch64 | N/A | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 |
| el9.x86_64 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 |
| el9.aarch64 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 |
| el10.x86_64 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 |
| el10.aarch64 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 | PGDG 2.0 |
| d12.x86_64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| d12.aarch64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| d13.x86_64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| d13.aarch64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| u22.x86_64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| u22.aarch64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| u24.x86_64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| u24.aarch64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| u26.x86_64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
| u26.aarch64 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 | PIGSTY 2.1 |
Source
github.com/HexaCluster/pg_dbms_job
pg_dbms_job-2.1.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
Sources:
pg_dbms_job 2.1.0 schedules SQL and PL/pgSQL jobs through an Oracle-style DBMS_JOB interface. It requires PostgreSQL 10 or later according to upstream documentation. Since 2.0, scheduling uses a PostgreSQL background worker; the old external scheduler command no longer describes this version.
Enable the Scheduler
Install matching files, preserve other required preload entries, and configure the jobs database and scheduler role:
Restart PostgreSQL after changing preload settings. In the configured database, a superuser installs the fixed, nonrelocatable schema:
The scheduler role must own the extension tables or be a superuser to bypass their row-level security, and must be able to assume job owners with SET ROLE. Configure authentication for its libpq LISTEN/NOTIFY connection; use protected password credentials rather than broadly enabling trust. Grant application roles only the necessary schema, table and routine privileges; the SQL script revokes PUBLIC access to the job interfaces.
Submit and Inspect Jobs
The submit entry point is a function returning a bigint job ID. Its job text is wrapped in a PL/pgSQL block and must include a terminating semicolon. This example assumes an existing public.accounts table:
Omitting the date and interval requests immediate asynchronous execution after commit. A future date with a null interval schedules a one-shot job. A repeating interval is SQL text that must evaluate to a future timestamp. Jobs run with the submitting role and saved search path; job visibility is limited by row-level security. Submission is not proof of successful execution: inspect history and failures.
Manage a Job
Use a real returned job ID for the following calls:
The interval and change procedures adjust recurrence or multiple job attributes. Notification polling uses naptime in milliseconds; fallback queue polling uses job_queue_interval in seconds. Size job_queue_processes together with PostgreSQL background-worker capacity and the workload.
Upgrade to 2.1.0
Version 2.1.0 fixes scheduler recovery after termination while the server remains running. The postmaster can restart the scheduler after its worker restart interval; server shutdown still stops it normally. Install matching library and SQL files, reload the preloaded library through a planned server restart, and use the supplied upgrade chain:
Check scheduler activity and representative jobs after the upgrade, especially if the jobs database was dropped or the scheduler was terminated.