]> granicus.if.org Git - postgresql/commit
Fix typcache's failure to treat ranges as container types.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 20 Oct 2017 21:12:27 +0000 (17:12 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 20 Oct 2017 21:12:27 +0000 (17:12 -0400)
commitb1752c3a7e1083014d2a46382d2fab163135be77
tree2eadb29479e34e3ef92daec8e0a45b2e398a0205
parent2ac59887475a20b7168a4e0dff7ad14602db0c2c
Fix typcache's failure to treat ranges as container types.

Like the similar logic for arrays and records, it's necessary to examine
the range's subtype to decide whether the range type can support hashing.
We can omit checking the subtype for btree-defined operations, though,
since range subtypes are required to have those operations.  (Possibly
that simplification for btree cases led us to overlook that it does
not apply for hash cases.)

This is only an issue if the subtype lacks hash support, which is not
true of any built-in range type, but it's easy to demonstrate a problem
with a range type over, eg, money: you can get a "could not identify
a hash function" failure when the planner is misled into thinking that
hash join or aggregation would work.

This was born broken, so back-patch to all supported branches.
src/backend/utils/cache/typcache.c
src/test/regress/expected/rangetypes.out
src/test/regress/sql/rangetypes.sql