pg_integrity_checksums 2.3.0

This Release
pg_integrity_checksums 2.3.0
Date
Status
Stable
Other Releases
Abstract
Multi-level data integrity checksums for PostgreSQL
Description
pg_integrity_checksums provides checksum functions for PostgreSQL at six granularity levels (page, cell, tuple, table, index and database), each in a physical and a logical variant (cell level is logical only). Physical checksums detect storage corruption and change after VACUUM FULL, CLUSTER or REINDEX. Logical checksums depend only on data content: they exclude relation OIDs, heap TIDs and type OIDs, canonicalize enum, numeric, array, composite and range values, are endian-independent, and do not require a primary key. Logical index checksums are derived from table data and the index definition, so they work for every access method. The implementation uses FNV-1a 32-bit by default and adds generic FNV-1a 32/64-bit overloads, supports parallel scans through the pg_integrity_checksums.workers GUC, and transparently aggregates partitioned tables and partitioned indexes. pg_integrity_checksums.strict makes database scans fail instead of skipping relations without a usable checksum.
Released By
VictorNagibator
License
MIT
Resources
Special Files
Tags

Extensions

pg_integrity_checksums 2.3.0
Checksum functions at page, cell, tuple, table, index and database level

Documentation

MIGRATION
Migrating from pg_checksums 1.x
installation
Installation
cli
pg_integrity_checksums CLI
index
PostgreSQL integrity checks you can run online
functions
Functions and algorithms
README
pg_integrity_checksums CLI
SECURITY
Security Policy
feature_request
feature_request
testing
Testing and releases
pull_request_template
pull_request_template
requirements-docs
requirements-docs
operations
Operations
bug_report
bug_report
concepts
Concepts
CONTRIBUTING
Contributing
troubleshooting
Troubleshooting
getting-started
Getting started
architecture
Architecture and internals
CODE_OF_CONDUCT
Contributor Covenant Code of Conduct

README

pg_integrity_checksums - Multi-Level Data Integrity Extension for PostgreSQL

CI CodeQL Quality Docker image PostgreSQL 12-19 PGEXT.CLOUD License: MIT Docs

Overview

pg_integrity_checksums provides page, cell, tuple, table, index and database checksums. Page checksums are physical; cell checksums are logical; the other levels support both physical and logical modes.

Logical checksums are canonical across endianness, VACUUM/REINDEX/physical movement and database OIDs. Physical checksums are for on-disk corruption in one specific cluster.

The default SQL API uses FNV-1a 32-bit and returns ordinary SQL integers:

SELECT pg_table_logical_checksum('public.orders'::regclass);
SELECT pg_table_physical_checksum('public.orders'::regclass, false);

A generic API with explicit FNV-1a 32-bit or 64-bit digests is available when a wider checksum or a raw bytea value is required. It is described in the function reference.

Page checksums remain PostgreSQL’s built-in 16-bit page checksum. pg_page_checksum_status(...) verifies a page against its stored checksum.

Quick start

CREATE EXTENSION pg_integrity_checksums;
SELECT pg_table_logical_checksum('public.orders'::regclass);

Install from packages, Docker, PGXN or build with PGXS:

git clone https://github.com/VictorNagibator/pg_integrity_checksums.git
cd pg_integrity_checksums
make
sudo make install

The CLI lives in cli/:

cd cli
go build ./cmd/pg_integrity_checksums
pg_integrity_checksums capture --db "$DATABASE_URL" --output baseline.json
pg_integrity_checksums verify --db "$DATABASE_URL" --baseline baseline.json

The CLI uses the 32-bit v1 baseline format by default. Add --hash fnv64 to capture when you explicitly need a 64-bit v2 baseline.

Documentation

Compatibility

The 32-bit numeric SQL functions are the default and remain fully supported, as are v1 baselines. The optional generic API adds explicit fnv32/fnv64 digests and v2 baselines; see Functions and algorithms and Concepts for selection guidance.

Support