pg_dbms_errlog
pg_dbms_errlog : Emulate DBMS_ERRLOG Oracle module to log DML errors in a dedicated table.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9270 | pg_dbms_errlog | pg_dbms_errlog | 2.4 |
SIM | ISC | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | dbms_errlog |
| Requires | pg_statement_rollback |
| See Also | pg_dbms_job pg_dbms_metadata pg_utl_smtp pg_dbms_lock orafce pg_cron pgagent pg_task |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 2.4 |
18 17 16 15 14 | pg_dbms_errlog |
pg_statement_rollback |
| RPM | PGDG | 2.2 |
18 17 16 15 14 | pg_dbms_errlog_$v |
pg_statement_rollback_$v |
| DEB | PIGSTY | 2.4 |
18 17 16 15 14 | postgresql-$v-pg-dbms-errlog |
postgresql-$v-pg-statement-rollback |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el8.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el9.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el9.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el10.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el10.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| d12.x86_64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| d12.aarch64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| d13.x86_64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| d13.aarch64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| u22.x86_64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| u22.aarch64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| u24.x86_64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| u24.aarch64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| u26.x86_64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
| u26.aarch64 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 | PIGSTY 2.4 |
Source
github.com/HexaCluster/pg_dbms_errlog
pg_dbms_errlog-2.4.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_errlog provides Oracle-style DML error logging for PostgreSQL. It queues an error from a failed INSERT, UPDATE, or DELETE, writes it to a registered ERR$_... table through background workers, and lets the surrounding script continue after rolling back to a savepoint. It requires either pg_statement_rollback or explicit savepoint management by the caller.
Enable the Extension
Add the library to shared_preload_libraries, ensure max_worker_processes can accommodate pg_dbms_errlog.max_workers plus the fixed worker, and restart PostgreSQL:
Create and register an error table for each DML target:
Log and Continue after an Error
The error table contains pg_err_number$, pg_err_mesg$, pg_err_optyp$, pg_err_tag$, pg_err_query$, and pg_err_detail$.
API and Configuration Index
dbms_errlog.create_error_log(dml_table_name, err_log_table_name, err_log_table_owner, err_log_table_space): creates and registers an error table.dbms_errlog.publish_queue(wait_for_completion): asks workers to process queued errors; execution is not granted toPUBLICby default.dbms_errlog.queue_size(): reports queued errors.pg_dbms_errlog.synchronous:transactionby default,query, oroff. Transaction mode guarantees that only errors from committed transactions are logged.pg_dbms_errlog.reject_limit: transaction-wide error limit;-1is unlimited and0logs nothing and rolls back.pg_dbms_errlog.no_client_error: suppresses client error messages while retaining server logging; enabled by default.pg_dbms_errlog.frequencyandpg_dbms_errlog.max_workers: asynchronous worker timing and concurrency.
Caveats
- A caller needs DML privileges on the target and error tables; creating an error table also requires execution and registration-table privileges described upstream.
INSERT INTO ... SELECT ...is one PostgreSQL statement and cannot preserve only successful rows in the Oracle manner.- Syntax and other parse-time errors are not logged. Stored query text must remain below PostgreSQL’s 1 GB value limit.
- Version
2.4changes no SQL API; it fixes worker shutdown loops and a dynamic-background-worker crash.