Dissociate btequalimage() from interval_ops, ending its deduplication.
Noah Misch <noah@leadboat.com>
Dissociate btequalimage() from interval_ops, ending its deduplication. Under interval_ops, some equal values are distinguishable. One such pair is '24:00:00' and '1 day'. With that being so, btequalimage() breaches the documented contract for the "equalimage" btree support function. This can cause incorrect results from index-only scans. Users should REINDEX any btree indexes having interval-type columns. After updating, pg_amcheck will report an error for almost all such indexes. This fix makes interval_ops simply omit the support function, like numeric_ops does. Back-pack to v13, where btequalimage() first appeared. In back branches, for the benefit of old catalog content, btequalimage() code will return false for type "interval". Going forward, back-branch initdb will include the catalog change. Reviewed by Peter Geoghegan. Discussion: https://postgr.es/m/20231011013317.22.nmisch@google.com
Files
| Path | Change | +/− |
|---|---|---|
| contrib/amcheck/verify_nbtree.c | modified | +12 −1 |
| src/backend/utils/adt/datum.c | modified | +6 −8 |
| src/include/catalog/pg_amproc.dat | modified | +0 −2 |
| src/include/catalog/pg_opfamily.dat | modified | +1 −1 |
| src/test/regress/expected/opr_sanity.out | modified | +2 −1 |
Discussion
- interval_ops shall stop using btequalimage (deduplication) 12 messages · 2023-10-11 → 2023-10-23