pg_catcheck

Diagnosing system catalog corruption

Overview

PackageVersionCategoryLicenseLanguage
pg_catcheck1.6.0ADMINBSD 3-ClauseC
IDExtensionBinLibLoadCreateTrustRelocSchema
5160pg_catcheckNoYesNoYesNoNo-
Relatedpg_checksums amcheck pg_surgery pageinspect pg_visibility pgstattuple ddlx pgdd

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG1.6.01817161514pg_catcheck-
RPMPGDG1.6.01817161514pg_catcheck_$v-
DEBPGDG1.6.01817161514postgresql-$v-pg-catcheck-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
d12.aarch64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
d13.x86_64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
d13.aarch64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u22.x86_64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u22.aarch64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u24.x86_64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u24.aarch64
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0

Install

You can install pg_catcheck 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 pg_catcheck;          # Install for current active PG version
pig ext install -y pg_catcheck -v 18  # PG 18
pig ext install -y pg_catcheck -v 17  # PG 17
pig ext install -y pg_catcheck -v 16  # PG 16
pig ext install -y pg_catcheck -v 15  # PG 15
pig ext install -y pg_catcheck -v 14  # PG 14
dnf install -y pg_catcheck_18       # PG 18
dnf install -y pg_catcheck_17       # PG 17
dnf install -y pg_catcheck_16       # PG 16
dnf install -y pg_catcheck_15       # PG 15
dnf install -y pg_catcheck_14       # PG 14
apt install -y postgresql-18-pg-catcheck   # PG 18
apt install -y postgresql-17-pg-catcheck   # PG 17
apt install -y postgresql-16-pg-catcheck   # PG 16
apt install -y postgresql-15-pg-catcheck   # PG 15
apt install -y postgresql-14-pg-catcheck   # PG 14

Create Extension:

CREATE EXTENSION pg_catcheck;

Usage

pg_catcheck: Diagnosing system catalog corruption

pg_catcheck is a command-line tool that checks PostgreSQL system catalogs for corruption by verifying cross-references between catalog tables. It accepts the same connection parameters as other PostgreSQL utilities (-h, -p, -U, -d).

Basic Usage

pg_catcheck -h localhost -p 5432 -d mydb

Normal output when no issues are found:

progress: done (0 inconsistencies, 0 warnings, 0 errors)

Example Output with Corruption

notice: pg_class row has invalid relnamespace "24580": no matching entry in pg_namespace
row identity: oid="24581" relname="foo" relkind="r"
notice: pg_type row has invalid typnamespace "24580": no matching entry in pg_namespace
row identity: oid="24583"
progress: done (4 inconsistencies, 0 warnings, 0 errors)

Result Categories

  • Inconsistencies: logical problems in catalog cross-references (e.g., dangling OID references)
  • Warnings: more serious issues
  • Errors: inability to read catalogs

Options

pg_catcheck --help                      # Full list of options
pg_catcheck --select-from-relations     # Also check for missing/inaccessible relation files

Connection

Supports the same options as psql: -h host, -p port, -U user, -d database, or connection strings/URLs.


Last Modified 2026-03-12: add pg extension catalog (95749bf)