Subject: How to interface hash access to user types

From: [email-masked] (Wolf-D. Ihlenfeldt)
Date: Thu, 14 Jul 94 20:19:56 jst

he Postgres 4.2 documentation explains in detail
how to interface user data types to btree access methods
but seems to be completely silent about introducing a
hash access method for a user data type. Does anybody
know the necessary steps ? 
Details: I need to access unsigned 64 bit integers. I have
a comprehensive set of functions for this type, and I 
was able to define a btree access for this type. However,
I always retrieve with the '=' operator and therefore
a hash access to these numbers (which are hashcodes themselves)
might be mor effective. Currently I fail with 
WARN:Jul 14 20:30:13:IndexCatalogInformation: no amop 405 65504 1
in the query
(dbxtool) print query
`wb_dbwrite`db_write_prepare`query = "retrieve (Molecules.oid) where Molecules.E_HASHY="5F25E412BAC38683"::uint8"

with an (unprepared) hash index on the E_HASHY field.

Thank you for your help.

WDI

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================

---

From: [email-masked] (Paul M. Aoki)
Date: Fri, 15 Jul 94 19:14:49 -0700

> know the necessary steps ? 

the hash am has only one strategy, which corresponds to "=" (instead 
of the five required by btrees).

the hash am needs one "support" function, which corresponds to your 
hash function (like btrees, which also have one support function).

once you know that, it shouldn't be too hard to figure out what to do
from the btree instructions and the existing contents of the catalogs..
--
  Paul M. Aoki          |  University of California at Berkeley
  [email-masked]  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776