Index: contrib/hstore/hstore_compat.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/hstore/hstore_compat.c,v
retrieving revision 1.2
diff -c -r1.2 hstore_compat.c
*** contrib/hstore/hstore_compat.c	26 Feb 2010 02:00:32 -0000	1.2
--- contrib/hstore/hstore_compat.c	15 Sep 2010 21:16:46 -0000
***************
*** 180,190 ****
  	if (hs->size_ & HS_FLAG_NEWVERSION)
  		return 0;
  
- 	Assert(sizeof(HOldEntry) == sizeof(HEntry));
- 
  	if (count == 0)
  		return 2;
  
  	if (count > 0xFFFFFFF)
  		return 0;
  
--- 180,191 ----
  	if (hs->size_ & HS_FLAG_NEWVERSION)
  		return 0;
  
  	if (count == 0)
  		return 2;
  
+ 	if (sizeof(HOldEntry) != 2*sizeof(HEntry))
+ 		return 0;
+ 
  	if (count > 0xFFFFFFF)
  		return 0;
  
Index: contrib/hstore/hstore_gist.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/hstore/hstore_gist.c,v
retrieving revision 1.12
diff -c -r1.12 hstore_gist.c
*** contrib/hstore/hstore_gist.c	26 Feb 2010 02:00:32 -0000	1.12
--- contrib/hstore/hstore_gist.c	15 Sep 2010 21:16:47 -0000
***************
*** 173,183 ****
  {
  	GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
  	GISTENTRY  *retval;
! 	HStore	   *key;
  
! 	key = DatumGetHStoreP(entry->key);
! 
! 	if (key != (HStore *) DatumGetPointer(entry->key))
  	{
  		/* need to pass back the decompressed item */
  		retval = palloc(sizeof(GISTENTRY));
--- 173,183 ----
  {
  	GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
  	GISTENTRY  *retval;
! 	void	   *key;      /* this is not an hstore, but a ghstore */
  
! 	key = DatumGetPointer(PG_DETOAST_DATUM(entry->key));
! 	
! 	if (key != DatumGetPointer(entry->key))
  	{
  		/* need to pass back the decompressed item */
  		retval = palloc(sizeof(GISTENTRY));
