pgsql: Fix typcache's failure to treat ranges as container types.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix typcache's failure to treat ranges as container types.
Date: 2017-10-20 21:12:54
Message-ID: E1e5eb8-0008Ld-IW@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d1ced611463d9b0fd0a3cb125e3d75d73ab16554

Modified Files
--------------
src/backend/utils/cache/typcache.c | 50 ++++++++++++++++++++++++++++++++
src/test/regress/expected/rangetypes.out | 12 ++++++++
src/test/regress/sql/rangetypes.sql | 12 ++++++++
3 files changed, 74 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2017-10-20 23:30:06 pgsql: Convert SGML IDs to lower case
Previous Message Tom Lane 2017-10-20 20:08:23 pgsql: Fix misimplementation of typcache logic for extended hashing.