pg_row_hashes
pg_row_hashes · Computes deterministic row fingerprints, checksums, and XOR aggregates with SeaHash and FarmHash variants.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100908 | pg_row_hashes | pg_row_hashes | 0.3.2 | FUNC | Unknown | Rust |
PostgreSQL · 17, 18
Usage
Sources:
- Official README
- Official version 0.3.2 implementation
- Official UUID XOR aggregate
- Official control file
pg_row_hashes provides deterministic, non-cryptographic fingerprints for ordered identifiers and map-like row checksums. Version 0.3.2 offers FarmHash 128-bit results as uuid, SeaHash 64-bit results as bigint, an underscore-joined MD5 identifier helper, and a UUID XOR aggregate.
Core Workflow
Use id_* functions when argument order is part of the identifier, and checksum_* functions for key/value pairs:
The extendable variants skip pairs whose value is NULL, so adding a new nullable field does not change old-row fingerprints until the field has a value. Non-extendable variants retain the key’s presence.
API
id_farmhash(VARIADIC text[])/id_seahash(VARIADIC text[]): ordered multi-part fingerprints.id_farmhash_bytea(bytea)/id_seahash_bytea(bytea): fingerprint raw bytes.id_underscore_md5(VARIADIC text[]): MD5 of arguments joined by_, returned asuuid.checksum_farmhash/checksum_seahash: order-normalized key/value checksums that retain null-valued keys.checksum_farmhash_extendable/checksum_seahash_extendable: skip null-valued pairs.bit_xor(uuid): parallel-safe UUID XOR aggregate.
Caveats
FarmHash, SeaHash, MD5, and XOR here are fingerprinting tools, not authentication, tamper evidence, or collision-resistant cryptography. Store the source/business key alongside any fingerprint and handle possible collisions. XOR also cancels duplicate equal UUIDs, so it cannot prove multiset contents by itself.
Checksum arguments are text key/value pairs and must have even arity. Callers must define stable type-to-text, locale, timezone, numeric, and JSON canonicalization rules; a formatting change changes the fingerprint. Version 0.3.2 builds for PostgreSQL 17/18, so verify the package feature matches the target server.