pg_pathcheck
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_pathcheck | 0.9.1 | ADMIN | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5250 | pg_pathcheck | No | Yes | Yes | No | No | No | - |
preload-only module; no CREATE EXTENSION objects; pg17-18 branch
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.9.1 | 1817161514 | pg_pathcheck | - |
| RPM | PIGSTY | 0.9.1 | 1817161514 | pg_pathcheck_$v | - |
| DEB | PIGSTY | 0.9.1 | 1817161514 | postgresql-$v-pg-pathcheck | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.9.1 el8.x86_64.pg18 : pg_pathcheck_18 pg_pathcheck_18-0.9.1-1PIGSTY.el8.x86_64.rpm
| PIGSTY 0.9.1 el8.x86_64.pg17 : pg_pathcheck_17 pg_pathcheck_17-0.9.1-1PIGSTY.el8.x86_64.rpm
| N/A | N/A | N/A |
| el8.aarch64 | PIGSTY 0.9.1 el8.aarch64.pg18 : pg_pathcheck_18 pg_pathcheck_18-0.9.1-1PIGSTY.el8.aarch64.rpm
| PIGSTY 0.9.1 el8.aarch64.pg17 : pg_pathcheck_17 pg_pathcheck_17-0.9.1-1PIGSTY.el8.aarch64.rpm
| N/A | N/A | N/A |
| el9.x86_64 | PIGSTY 0.9.1 el9.x86_64.pg18 : pg_pathcheck_18 pg_pathcheck_18-0.9.1-1PIGSTY.el9.x86_64.rpm
| PIGSTY 0.9.1 el9.x86_64.pg17 : pg_pathcheck_17 pg_pathcheck_17-0.9.1-1PIGSTY.el9.x86_64.rpm
| N/A | N/A | N/A |
| el9.aarch64 | PIGSTY 0.9.1 el9.aarch64.pg18 : pg_pathcheck_18 pg_pathcheck_18-0.9.1-1PIGSTY.el9.aarch64.rpm
| PIGSTY 0.9.1 el9.aarch64.pg17 : pg_pathcheck_17 pg_pathcheck_17-0.9.1-1PIGSTY.el9.aarch64.rpm
| N/A | N/A | N/A |
| el10.x86_64 | PIGSTY 0.9.1 el10.x86_64.pg18 : pg_pathcheck_18 pg_pathcheck_18-0.9.1-1PIGSTY.el10.x86_64.rpm
| PIGSTY 0.9.1 el10.x86_64.pg17 : pg_pathcheck_17 pg_pathcheck_17-0.9.1-1PIGSTY.el10.x86_64.rpm
| N/A | N/A | N/A |
| el10.aarch64 | PIGSTY 0.9.1 el10.aarch64.pg18 : pg_pathcheck_18 pg_pathcheck_18-0.9.1-1PIGSTY.el10.aarch64.rpm
| PIGSTY 0.9.1 el10.aarch64.pg17 : pg_pathcheck_17 pg_pathcheck_17-0.9.1-1PIGSTY.el10.aarch64.rpm
| N/A | N/A | N/A |
| d12.x86_64 | PIGSTY 0.9.1 d12.x86_64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~bookworm_amd64.deb
| PIGSTY 0.9.1 d12.x86_64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~bookworm_amd64.deb
| N/A | N/A | N/A |
| d12.aarch64 | PIGSTY 0.9.1 d12.aarch64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~bookworm_arm64.deb
| PIGSTY 0.9.1 d12.aarch64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~bookworm_arm64.deb
| N/A | N/A | N/A |
| d13.x86_64 | PIGSTY 0.9.1 d13.x86_64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~trixie_amd64.deb
| PIGSTY 0.9.1 d13.x86_64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~trixie_amd64.deb
| N/A | N/A | N/A |
| d13.aarch64 | PIGSTY 0.9.1 d13.aarch64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~trixie_arm64.deb
| PIGSTY 0.9.1 d13.aarch64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~trixie_arm64.deb
| N/A | N/A | N/A |
| u22.x86_64 | PIGSTY 0.9.1 u22.x86_64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~jammy_amd64.deb
| PIGSTY 0.9.1 u22.x86_64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~jammy_amd64.deb
| N/A | N/A | N/A |
| u22.aarch64 | PIGSTY 0.9.1 u22.aarch64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~jammy_arm64.deb
| PIGSTY 0.9.1 u22.aarch64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~jammy_arm64.deb
| N/A | N/A | N/A |
| u24.x86_64 | PIGSTY 0.9.1 u24.x86_64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~noble_amd64.deb
| PIGSTY 0.9.1 u24.x86_64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~noble_amd64.deb
| N/A | N/A | N/A |
| u24.aarch64 | PIGSTY 0.9.1 u24.aarch64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~noble_arm64.deb
| PIGSTY 0.9.1 u24.aarch64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~noble_arm64.deb
| N/A | N/A | N/A |
| u26.x86_64 | PIGSTY 0.9.1 u26.x86_64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~resolute_amd64.deb
| PIGSTY 0.9.1 u26.x86_64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~resolute_amd64.deb
| N/A | N/A | N/A |
| u26.aarch64 | PIGSTY 0.9.1 u26.aarch64.pg18 : postgresql-18-pg-pathcheck postgresql-18-pg-pathcheck_0.9.1-1PIGSTY~resolute_arm64.deb
| PIGSTY 0.9.1 u26.aarch64.pg17 : postgresql-17-pg-pathcheck postgresql-17-pg-pathcheck_0.9.1-1PIGSTY~resolute_arm64.deb
| N/A | N/A | N/A |
Build
You can build the RPM / DEB packages for pg_pathcheck using pig build:
Install
You can install pg_pathcheck directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Usage
Sources: README, 0.9.1 PG17/18 release, PGXN metadata, source
pg_pathcheck is a PostgreSQL planner diagnostics module that validates reachable planner Path trees and reports pointers that look freed, corrupt, or re-used for the wrong relation. It is a preload-only shared library: it registers planner hooks and custom GUCs, but it does not create SQL functions, operators, views, or tables.
Loading The Module
Build pg_pathcheck against the PostgreSQL source line you want to test. The upstream README documents separate long-running branches for PostgreSQL 17/18 and PostgreSQL master/19devel; version 0.9.1 is published for the PG17/18 branch and the PGXN metadata also describes the 0.9.1 source package.
Add the module to shared_preload_libraries and restart PostgreSQL:
There is no CREATE EXTENSION pg_pathcheck step. After preload, run ordinary SQL, EXPLAIN, regression tests, or PostgreSQL test suites; pg_pathcheck checks planner paths as queries are planned.
For one temporary cluster:
For PostgreSQL test clusters spawned by make check-world, use TEMP_CONFIG:
Configuration
pg_pathcheck.elevel controls the severity used when a bad Path is detected:
Use warning or log for broad coverage while tests continue, error to stop on the first offending query, and panic only when a backend crash and core dump are useful for post-mortem debugging.
pg_pathcheck.stage_checks enables additional per-stage checks:
When enabled, the module checks pathlists at base-rel, join-rel, and upper-rel hook boundaries so a finding can be tied to a narrower planner stage. Leave it off for routine runs because the extra walks add planner overhead, especially for join-heavy queries.
What Gets Checked
The module walks planner roots, relation pathlists, partial pathlists, cheapest path slots, parameterized paths, subquery subroots, subplan subroots, and nested Path fields such as join children, append children, sort subpaths, bitmap paths, and similar compound-path members.
It reports two main classes of problem:
- Invalid
NodeTag: the pointer no longer looks like a PostgreSQLPathnode. - Parent mismatch: a valid-looking
Pathon a base or join relation points at a differentRelOptInfo, which can indicate same-size memory reuse after a stale path pointer survived.
A typical finding includes the bad tag or mismatch, the containing slot such as pathlist, partial_pathlist, cheapest_total_path, or a nested path field, the relation names that could be resolved, pathlist detail, and the query string available through PostgreSQL debug state.
Caveats
pg_pathcheck is a debug aid for PostgreSQL planner development and extension testing, not a user-facing SQL extension. A PostgreSQL cassert/debug build gives better signal because freed memory is easier to recognize. The upstream README notes coverage differences between the PG17/18 branch and the master branch: PG17/18 checks before later planning stages such as create_plan and setrefs.c, while master can use the newer planner shutdown hook.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)