*** src/backend/catalog/index.c.orig	Mon Aug 25 18:42:32 2008
--- src/backend/catalog/index.c	Thu Sep  4 16:20:12 2008
***************
*** 133,138 ****
--- 133,139 ----
  		Form_pg_attribute to = indexTupDesc->attrs[i];
  		HeapTuple	tuple;
  		Form_pg_type typeTup;
+ 		Form_pg_opclass opclassTup;
  		Oid			keyType;
  
  		if (atnum != 0)
***************
*** 240,246 ****
  		if (!HeapTupleIsValid(tuple))
  			elog(ERROR, "cache lookup failed for opclass %u",
  				 classObjectId[i]);
! 		keyType = ((Form_pg_opclass) GETSTRUCT(tuple))->opckeytype;
  		ReleaseSysCache(tuple);
  
  		if (OidIsValid(keyType) && keyType != to->atttypid)
--- 241,252 ----
  		if (!HeapTupleIsValid(tuple))
  			elog(ERROR, "cache lookup failed for opclass %u",
  				 classObjectId[i]);
! 		opclassTup = (Form_pg_opclass) GETSTRUCT(tuple);
! 		/* HACK: make hash always use int4 as storage (really it's uint32) */
! 		if (opclassTup->opcmethod == HASH_AM_OID)
! 			keyType = INT4OID;
! 		else
! 			keyType = opclassTup->opckeytype;
  		ReleaseSysCache(tuple);
  
  		if (OidIsValid(keyType) && keyType != to->atttypid)
