Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ed807fd

Browse files
committed
pageinspect: Try to fix some bugs in previous commit.
Commit 08bf6e5 seems not to have used the correct *GetDatum and PG_GETARG_* macros for the SQL types in some cases, and some of the SQL types seem to have been poorly chosen, too. Try to fix it. I'm not sure if this is the reason why the buildfarm is currently unhappy with this code, but it seems like a good place to start. Buildfarm unhappiness reported by Tom Lane.
1 parent fd6cd69 commit ed807fd

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

contrib/pageinspect/hashfuncs.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ PG_FUNCTION_INFO_V1(hash_metapage_info);
3232
*/
3333
typedef struct HashPageStat
3434
{
35-
uint16 live_items;
36-
uint16 dead_items;
37-
uint16 page_size;
38-
uint16 free_size;
35+
int live_items;
36+
int dead_items;
37+
int page_size;
38+
int free_size;
3939

4040
/* opaque data */
4141
BlockNumber hasho_prevblkno;
@@ -256,15 +256,15 @@ hash_page_stats(PG_FUNCTION_ARGS)
256256
MemSet(nulls, 0, sizeof(nulls));
257257

258258
j = 0;
259-
values[j++] = UInt16GetDatum(stat.live_items);
260-
values[j++] = UInt16GetDatum(stat.dead_items);
261-
values[j++] = UInt16GetDatum(stat.page_size);
262-
values[j++] = UInt16GetDatum(stat.free_size);
263-
values[j++] = UInt32GetDatum(stat.hasho_prevblkno);
264-
values[j++] = UInt32GetDatum(stat.hasho_nextblkno);
265-
values[j++] = UInt32GetDatum(stat.hasho_bucket);
266-
values[j++] = UInt16GetDatum(stat.hasho_flag);
267-
values[j++] = UInt16GetDatum(stat.hasho_page_id);
259+
values[j++] = Int32GetDatum(stat.live_items);
260+
values[j++] = Int32GetDatum(stat.dead_items);
261+
values[j++] = Int32GetDatum(stat.page_size);
262+
values[j++] = Int32GetDatum(stat.free_size);
263+
values[j++] = Int64GetDatum((int64) stat.hasho_prevblkno);
264+
values[j++] = Int64GetDatum((int64) stat.hasho_nextblkno);
265+
values[j++] = Int64GetDatum((int64) stat.hasho_bucket);
266+
values[j++] = Int32GetDatum((int32) stat.hasho_flag);
267+
values[j++] = Int32GetDatum((int32) stat.hasho_page_id);
268268

269269
tuple = heap_form_tuple(tupleDesc, values, nulls);
270270

@@ -388,7 +388,7 @@ Datum
388388
hash_bitmap_info(PG_FUNCTION_ARGS)
389389
{
390390
Oid indexRelid = PG_GETARG_OID(0);
391-
uint32 ovflblkno = PG_GETARG_UINT32(1);
391+
BlockNumber ovflblkno = (BlockNumber) PG_GETARG_INT64(1);
392392
HashMetaPage metap;
393393
Buffer buf,
394394
metabuf;

contrib/pageinspect/pageinspect--1.5--1.6.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ LANGUAGE C STRICT PARALLEL SAFE;
1919
-- hash_page_stats()
2020
--
2121
CREATE FUNCTION hash_page_stats(IN page bytea,
22-
OUT live_items smallint,
23-
OUT dead_items smallint,
24-
OUT page_size smallint,
25-
OUT free_size smallint,
22+
OUT live_items int4,
23+
OUT dead_items int4,
24+
OUT page_size int4,
25+
OUT free_size int4,
2626
OUT hasho_prevblkno int8,
2727
OUT hasho_nextblkno int8,
2828
OUT hasho_bucket int8,
29-
OUT hasho_flag smallint,
29+
OUT hasho_flag int4,
3030
OUT hasho_page_id int4)
3131
AS 'MODULE_PATHNAME', 'hash_page_stats'
3232
LANGUAGE C STRICT PARALLEL SAFE;

0 commit comments

Comments
 (0)