@@ -360,7 +360,7 @@ hash_page_items(PG_FUNCTION_ARGS)
360360values [j ++ ]= PointerGetDatum (& itup -> t_tid );
361361
362362hashkey = _hash_get_indextuple_hashkey (itup );
363- values [j ]= UInt32GetDatum ( hashkey );
363+ values [j ]= UInt64GetDatum (( uint64 ) hashkey );
364364
365365tuple = heap_form_tuple (fctx -> attinmeta -> tupdesc ,values ,nulls );
366366result = HeapTupleGetDatum (tuple );
@@ -388,7 +388,7 @@ Datum
388388hash_bitmap_info (PG_FUNCTION_ARGS )
389389{
390390Oid indexRelid = PG_GETARG_OID (0 );
391- BlockNumber ovflblkno = ( BlockNumber ) PG_GETARG_INT64 (1 );
391+ uint64 ovflblkno = PG_GETARG_INT64 (1 );
392392HashMetaPage metap ;
393393Buffer buf ,
394394metabuf ;
@@ -422,13 +422,14 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
422422(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
423423errmsg ("cannot access temporary tables of other sessions" )));
424424
425- if (RelationGetNumberOfBlocks ( indexRel ) <= ( BlockNumber ) ( ovflblkno ))
425+ if (ovflblkno >= RelationGetNumberOfBlocks ( indexRel ))
426426ereport (ERROR ,
427427(errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
428- errmsg ("block number%u is out of range for relation \"%s\"" ,
428+ errmsg ("block number" UINT64_FORMAT " is out of range for relation \"%s\"" ,
429429ovflblkno ,RelationGetRelationName (indexRel ))));
430430
431- buf = ReadBufferExtended (indexRel ,MAIN_FORKNUM ,ovflblkno ,RBM_NORMAL ,NULL );
431+ buf = ReadBufferExtended (indexRel ,MAIN_FORKNUM , (BlockNumber )ovflblkno ,
432+ RBM_NORMAL ,NULL );
432433LockBuffer (buf ,BUFFER_LOCK_SHARE );
433434_hash_checkpage (indexRel ,buf ,LH_PAGE_TYPE );
434435page = BufferGetPage (buf );
@@ -451,7 +452,7 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
451452metap = HashPageGetMeta (BufferGetPage (metabuf ));
452453
453454/* Identify overflow bit number */
454- ovflbitno = _hash_ovflblkno_to_bitno (metap ,ovflblkno );
455+ ovflbitno = _hash_ovflblkno_to_bitno (metap ,( BlockNumber ) ovflblkno );
455456
456457bitmappage = ovflbitno >>BMPG_SHIFT (metap );
457458bitmapbit = ovflbitno & BMPG_MASK (metap );
@@ -475,7 +476,7 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
475476MemSet (nulls ,0 ,sizeof (nulls ));
476477
477478j = 0 ;
478- values [j ++ ]= UInt32GetDatum ( bitmapblkno );
479+ values [j ++ ]= UInt64GetDatum (( uint64 ) bitmapblkno );
479480values [j ++ ]= Int32GetDatum (bitmapbit );
480481values [j ++ ]= BoolGetDatum (bit );
481482
@@ -524,34 +525,34 @@ hash_metapage_info(PG_FUNCTION_ARGS)
524525MemSet (nulls ,0 ,sizeof (nulls ));
525526
526527j = 0 ;
527- values [j ++ ]= UInt32GetDatum (metad -> hashm_magic );
528- values [j ++ ]= UInt32GetDatum (metad -> hashm_version );
528+ values [j ++ ]= UInt64GetDatum (metad -> hashm_magic );
529+ values [j ++ ]= UInt64GetDatum (metad -> hashm_version );
529530values [j ++ ]= Float8GetDatum (metad -> hashm_ntuples );
530- values [j ++ ]= UInt16GetDatum (metad -> hashm_ffactor );
531- values [j ++ ]= UInt16GetDatum (metad -> hashm_bsize );
532- values [j ++ ]= UInt16GetDatum (metad -> hashm_bmsize );
533- values [j ++ ]= UInt16GetDatum (metad -> hashm_bmshift );
534- values [j ++ ]= UInt32GetDatum (metad -> hashm_maxbucket );
535- values [j ++ ]= UInt32GetDatum (metad -> hashm_highmask );
536- values [j ++ ]= UInt32GetDatum (metad -> hashm_lowmask );
537- values [j ++ ]= UInt32GetDatum (metad -> hashm_ovflpoint );
538- values [j ++ ]= UInt32GetDatum (metad -> hashm_firstfree );
539- values [j ++ ]= UInt32GetDatum (metad -> hashm_nmaps );
540- values [j ++ ]= UInt16GetDatum (metad -> hashm_procid );
531+ values [j ++ ]= UInt32GetDatum (metad -> hashm_ffactor );
532+ values [j ++ ]= UInt32GetDatum (metad -> hashm_bsize );
533+ values [j ++ ]= UInt32GetDatum (metad -> hashm_bmsize );
534+ values [j ++ ]= UInt32GetDatum (metad -> hashm_bmshift );
535+ values [j ++ ]= UInt64GetDatum (metad -> hashm_maxbucket );
536+ values [j ++ ]= UInt64GetDatum (metad -> hashm_highmask );
537+ values [j ++ ]= UInt64GetDatum (metad -> hashm_lowmask );
538+ values [j ++ ]= UInt64GetDatum (metad -> hashm_ovflpoint );
539+ values [j ++ ]= UInt64GetDatum (metad -> hashm_firstfree );
540+ values [j ++ ]= UInt64GetDatum (metad -> hashm_nmaps );
541+ values [j ++ ]= UInt32GetDatum (metad -> hashm_procid );
541542
542543for (i = 0 ;i < HASH_MAX_SPLITPOINTS ;i ++ )
543- spares [i ]= UInt32GetDatum (metad -> hashm_spares [i ]);
544+ spares [i ]= UInt64GetDatum (metad -> hashm_spares [i ]);
544545values [j ++ ]= PointerGetDatum (construct_array (spares ,
545546HASH_MAX_SPLITPOINTS ,
546547INT8OID ,
547- 8 ,true ,'d' ));
548+ 8 ,FLOAT8PASSBYVAL ,'d' ));
548549
549550for (i = 0 ;i < HASH_MAX_BITMAPS ;i ++ )
550- mapp [i ]= UInt32GetDatum (metad -> hashm_mapp [i ]);
551+ mapp [i ]= UInt64GetDatum (metad -> hashm_mapp [i ]);
551552values [j ++ ]= PointerGetDatum (construct_array (mapp ,
552553HASH_MAX_BITMAPS ,
553554INT8OID ,
554- 8 ,true ,'d' ));
555+ 8 ,FLOAT8PASSBYVAL ,'d' ));
555556
556557tuple = heap_form_tuple (tupleDesc ,values ,nulls );
557558