@@ -360,7 +360,7 @@ hash_page_items(PG_FUNCTION_ARGS)
360
360
values [j ++ ] = PointerGetDatum (& itup -> t_tid );
361
361
362
362
hashkey = _hash_get_indextuple_hashkey (itup );
363
- values [j ] = UInt32GetDatum ( hashkey );
363
+ values [j ] = UInt64GetDatum (( uint64 ) hashkey );
364
364
365
365
tuple = heap_form_tuple (fctx -> attinmeta -> tupdesc , values , nulls );
366
366
result = HeapTupleGetDatum (tuple );
@@ -388,7 +388,7 @@ Datum
388
388
hash_bitmap_info (PG_FUNCTION_ARGS )
389
389
{
390
390
Oid indexRelid = PG_GETARG_OID (0 );
391
- BlockNumber ovflblkno = ( BlockNumber ) PG_GETARG_INT64 (1 );
391
+ uint64 ovflblkno = PG_GETARG_INT64 (1 );
392
392
HashMetaPage metap ;
393
393
Buffer buf ,
394
394
metabuf ;
@@ -422,13 +422,14 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
422
422
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
423
423
errmsg ("cannot access temporary tables of other sessions" )));
424
424
425
- if (RelationGetNumberOfBlocks ( indexRel ) <= ( BlockNumber ) ( ovflblkno ))
425
+ if (ovflblkno >= RelationGetNumberOfBlocks ( indexRel ))
426
426
ereport (ERROR ,
427
427
(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\"" ,
429
429
ovflblkno , RelationGetRelationName (indexRel ))));
430
430
431
- buf = ReadBufferExtended (indexRel , MAIN_FORKNUM , ovflblkno , RBM_NORMAL , NULL );
431
+ buf = ReadBufferExtended (indexRel , MAIN_FORKNUM , (BlockNumber ) ovflblkno ,
432
+ RBM_NORMAL , NULL );
432
433
LockBuffer (buf , BUFFER_LOCK_SHARE );
433
434
_hash_checkpage (indexRel , buf , LH_PAGE_TYPE );
434
435
page = BufferGetPage (buf );
@@ -451,7 +452,7 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
451
452
metap = HashPageGetMeta (BufferGetPage (metabuf ));
452
453
453
454
/* Identify overflow bit number */
454
- ovflbitno = _hash_ovflblkno_to_bitno (metap , ovflblkno );
455
+ ovflbitno = _hash_ovflblkno_to_bitno (metap , ( BlockNumber ) ovflblkno );
455
456
456
457
bitmappage = ovflbitno >> BMPG_SHIFT (metap );
457
458
bitmapbit = ovflbitno & BMPG_MASK (metap );
@@ -475,7 +476,7 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
475
476
MemSet (nulls , 0 , sizeof (nulls ));
476
477
477
478
j = 0 ;
478
- values [j ++ ] = UInt32GetDatum ( bitmapblkno );
479
+ values [j ++ ] = UInt64GetDatum (( uint64 ) bitmapblkno );
479
480
values [j ++ ] = Int32GetDatum (bitmapbit );
480
481
values [j ++ ] = BoolGetDatum (bit );
481
482
@@ -524,34 +525,34 @@ hash_metapage_info(PG_FUNCTION_ARGS)
524
525
MemSet (nulls , 0 , sizeof (nulls ));
525
526
526
527
j = 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 );
529
530
values [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 );
541
542
542
543
for (i = 0 ; i < HASH_MAX_SPLITPOINTS ; i ++ )
543
- spares [i ] = UInt32GetDatum (metad -> hashm_spares [i ]);
544
+ spares [i ] = UInt64GetDatum (metad -> hashm_spares [i ]);
544
545
values [j ++ ] = PointerGetDatum (construct_array (spares ,
545
546
HASH_MAX_SPLITPOINTS ,
546
547
INT8OID ,
547
- 8 , true , 'd' ));
548
+ 8 , FLOAT8PASSBYVAL , 'd' ));
548
549
549
550
for (i = 0 ; i < HASH_MAX_BITMAPS ; i ++ )
550
- mapp [i ] = UInt32GetDatum (metad -> hashm_mapp [i ]);
551
+ mapp [i ] = UInt64GetDatum (metad -> hashm_mapp [i ]);
551
552
values [j ++ ] = PointerGetDatum (construct_array (mapp ,
552
553
HASH_MAX_BITMAPS ,
553
554
INT8OID ,
554
- 8 , true , 'd' ));
555
+ 8 , FLOAT8PASSBYVAL , 'd' ));
555
556
556
557
tuple = heap_form_tuple (tupleDesc , values , nulls );
557
558
0 commit comments