In this article
Unconstrained bpchar B-tree indexes require a post-update REINDEX review; the 18.7 fix prevents new unsafe deduplication but does not repair old entries.
PostgreSQL 18.7, released November 12, disables B-tree deduplication for unconstrained bpchar columns. Equality ignores trailing spaces, so equal values need not have identical bytes; deduplication could make index-only scans return subtly wrong results. The release explicitly separates prevention from repair: new entries stop using the unsafe optimization, but existing affected indexes should be reindexed after updating. Installing the binary does not reconstruct old index contents.
Find the exact affected declaration
The notes distinguish bare bpchar from CHAR(n). The common length-constrained form is not at risk from this particular problem because equal strings have the same length and hence the relevant bytewise equality. An inventory should inspect actual column types and constraints rather than flag every character column by its underlying implementation. A proposed schema review records the affected columns and their B-tree indexes, keeping unrelated text types outside the stated repair scope.
Equality does not authorize value substitution
Deduplication relies on a stronger assumption than SQL equality when index-only scans may return stored values. Trailing-space-insensitive comparison makes the distinction observable for unconstrained bpchar. A proposed regression fixture uses equal values with different byte lengths and checks returned values, not only comparison truth. A test that merely confirms equality would pass while missing the representation error. This is a semantic correctness check, not a claim that every query against such a column was wrong.
Rebuild after the preventive code is installed
The release recommends REINDEX after installing the update because existing deduplicated entries are not repaired in place. The operational sequence matters: prevention should be active before rebuilding the affected structures. A qualification plan records the updated server version, target indexes and rebuild completion, then reruns the correctness case. The notes do not prescribe one universal maintenance window or concurrency mode, so those choices must follow the installation’s workload and PostgreSQL command constraints.
Keep recovery evidence narrower than global health
A successful rebuild addresses this index-content risk for the identified targets. It does not certify every index type or every backup made before repair. The same release contains other independent corruption fixes, so maintenance reporting should retain which structures were examined and why. The practical conclusion is a two-part action: install the preventive change and rebuild affected existing indexes. Neither half can be inferred from the other’s completion.
Sources
Related reading
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.