Add planner support functions for range operators <@ and @>.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Jan 2024 18:57:54 +0000 (13:57 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Jan 2024 18:57:54 +0000 (13:57 -0500)
commit075df6b2080b13e0a5adc88737b7c24417a873c1
tree85d338b2c24b52e74b006fb7766d8259307276e5
parentabb0b4fc03fcf5a0ca786bd88c357bf9213aa6e1
Add planner support functions for range operators <@ and @>.

These support functions will transform expressions with constant
range values into direct comparisons on the range bound values,
which are frequently better-optimizable.  The transformation is
skipped however if it would require double evaluation of a
volatile or expensive element expression.

Along the way, add the range opfamily OID to range typcache entries,
since load_rangetype_info has to compute that anyway and it seems
silly to duplicate the work later.

Kim Johan Andersson and Jian He, reviewed by Laurenz Albe

Discussion: https://postgr.es/m/94f64d1f-b8c0-b0c5-98bc-0793a34e0851@kimmet.dk
src/backend/utils/adt/rangetypes.c
src/backend/utils/adt/rangetypes_selfuncs.c
src/backend/utils/cache/typcache.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/utils/typcache.h
src/test/regress/expected/rangetypes.out
src/test/regress/sql/rangetypes.sql