]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Dissociate btequalimage() from interval_ops, ending its deduplication.
authorNoah Misch <noah@leadboat.com>
Sat, 14 Oct 2023 23:33:51 +0000 (16:33 -0700)
committerNoah Misch <noah@leadboat.com>
Sat, 14 Oct 2023 23:33:54 +0000 (16:33 -0700)
commit6fd1dbdb21cb02ea2d307cc8fd931e6a218bfa64
treed6ae6807f1c58b1bc4389f6bc104450a050629a8
parent3895e9153e29af66b038cf17756b4307fa967718
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
contrib/amcheck/verify_nbtree.c
src/backend/utils/adt/datum.c
src/include/catalog/pg_amproc.dat
src/include/catalog/pg_opfamily.dat
src/test/regress/expected/opr_sanity.out