pg_catcheck
Diagnosing system catalog corruption
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_catcheck | 1.6.0 | ADMIN | BSD 3-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5160 | pg_catcheck | No | Yes | No | Yes | No | No | - |
| Related | pg_checksums amcheck pg_surgery pageinspect pg_visibility pgstattuple ddlx pgdd |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.6.0 | 1817161514 | pg_catcheck | - |
| RPM | PGDG | 1.6.0 | 1817161514 | pg_catcheck_$v | - |
| DEB | PGDG | 1.6.0 | 1817161514 | postgresql-$v-pg-catcheck | - |
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 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.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.