pgdisablelogerror

Disable selected SQLSTATE error codes from PostgreSQL server logging.

Overview

PackageVersionCategoryLicenseLanguage
pgdisablelogerror1.0ADMINBSDC
IDExtensionBinLibLoadCreateTrustRelocSchema
5260pgdisablelogerrorNoYesYesYesNoYes-
Relatedlogerrors pgauditlogtofile

PGDG RPM and Pigsty DEB package fmbiete/pgdisablelogerror 1.0; control is relocatable=true and requires shared_preload_libraries.

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG1.01817161514pgdisablelogerror-
RPMPGDG1.01817161514pgdisablelogerror_$v-
DEBPIGSTY1.01817161514postgresql-$v-pgdisablelogerror-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
d12.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
d13.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
d13.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u22.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u22.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u24.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u24.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u26.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u26.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0

Build

You can build the RPM / DEB packages for pgdisablelogerror using pig build:

pig build pkg pgdisablelogerror         # build RPM / DEB packages

Install

You can install pgdisablelogerror directly. First, make sure the PGDG repository is added and enabled:

pig repo add pgdg -u          # Add PGDG repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install pgdisablelogerror;          # Install for current active PG version
pig ext install -y pgdisablelogerror -v 18  # PG 18
pig ext install -y pgdisablelogerror -v 17  # PG 17
pig ext install -y pgdisablelogerror -v 16  # PG 16
pig ext install -y pgdisablelogerror -v 15  # PG 15
pig ext install -y pgdisablelogerror -v 14  # PG 14
dnf install -y pgdisablelogerror_18       # PG 18
dnf install -y pgdisablelogerror_17       # PG 17
dnf install -y pgdisablelogerror_16       # PG 16
dnf install -y pgdisablelogerror_15       # PG 15
dnf install -y pgdisablelogerror_14       # PG 14
apt install -y postgresql-18-pgdisablelogerror   # PG 18
apt install -y postgresql-17-pgdisablelogerror   # PG 17
apt install -y postgresql-16-pgdisablelogerror   # PG 16
apt install -y postgresql-15-pgdisablelogerror   # PG 15
apt install -y postgresql-14-pgdisablelogerror   # PG 14

Preload:

shared_preload_libraries = '$libdir/pgdisablelogerror';

Create Extension:

CREATE EXTENSION pgdisablelogerror;

Usage

Sources: README, v1.0 release, control file

pgdisablelogerror suppresses PostgreSQL server log entries for configured SQLSTATE error codes. It is useful when expected application errors, such as duplicate-key violations, are too noisy in the server log.

Enable The Hook

Load the module and restart PostgreSQL:

shared_preload_libraries = 'pgdisablelogerror'

Create the extension once in the postgres database:

CREATE EXTENSION pgdisablelogerror;

Configure SQLSTATE Codes

Set pgdisablelogerror.sqlerrcode to a comma-separated list of SQLSTATE codes:

pgdisablelogerror.sqlerrcode = '23505,23503'

An empty or NULL value disables suppression:

pgdisablelogerror.sqlerrcode = ''

To identify SQLSTATE values in normal PostgreSQL logs, add %e to log_line_prefix.

Caveats

  • Version 1.0 supports PostgreSQL 14-18.
  • This extension affects logging, not error behavior. Clients still receive the original error.
  • Use narrow SQLSTATE lists. Suppressing broad error classes can hide real operational problems.

Last Modified 2026-07-01: routine extension udpate (aed637d)