summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2017-02-03 03:29:29 +0000
committerRobert Haas2017-02-03 03:32:06 +0000
commited807fda6d5102537daa5d725e716555cbc49f44 (patch)
tree323877bcdbcd74436e23a8b16e49b2beb2594f11
parentfd6cd698031d3dbeccafde49a8b118cb840312aa (diff)
pageinspect: Try to fix some bugs in previous commit.
Commit 08bf6e529587e1e9075d013d859af2649c32a511 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.
-rw-r--r--contrib/pageinspect/hashfuncs.c28
-rw-r--r--contrib/pageinspect/pageinspect--1.5--1.6.sql10
2 files changed, 19 insertions, 19 deletions
diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c
index 5812afe9366..fd0ef08d553 100644
--- a/contrib/pageinspect/hashfuncs.c
+++ b/contrib/pageinspect/hashfuncs.c
@@ -32,10 +32,10 @@ PG_FUNCTION_INFO_V1(hash_metapage_info);
*/
typedef struct HashPageStat
{
- uint16 live_items;
- uint16 dead_items;
- uint16 page_size;
- uint16 free_size;
+ int live_items;
+ int dead_items;
+ int page_size;
+ int free_size;
/* opaque data */
BlockNumber hasho_prevblkno;
@@ -256,15 +256,15 @@ hash_page_stats(PG_FUNCTION_ARGS)
MemSet(nulls, 0, sizeof(nulls));
j = 0;
- values[j++] = UInt16GetDatum(stat.live_items);
- values[j++] = UInt16GetDatum(stat.dead_items);
- values[j++] = UInt16GetDatum(stat.page_size);
- values[j++] = UInt16GetDatum(stat.free_size);
- values[j++] = UInt32GetDatum(stat.hasho_prevblkno);
- values[j++] = UInt32GetDatum(stat.hasho_nextblkno);
- values[j++] = UInt32GetDatum(stat.hasho_bucket);
- values[j++] = UInt16GetDatum(stat.hasho_flag);
- values[j++] = UInt16GetDatum(stat.hasho_page_id);
+ values[j++] = Int32GetDatum(stat.live_items);
+ values[j++] = Int32GetDatum(stat.dead_items);
+ values[j++] = Int32GetDatum(stat.page_size);
+ values[j++] = Int32GetDatum(stat.free_size);
+ values[j++] = Int64GetDatum((int64) stat.hasho_prevblkno);
+ values[j++] = Int64GetDatum((int64) stat.hasho_nextblkno);
+ values[j++] = Int64GetDatum((int64) stat.hasho_bucket);
+ values[j++] = Int32GetDatum((int32) stat.hasho_flag);
+ values[j++] = Int32GetDatum((int32) stat.hasho_page_id);
tuple = heap_form_tuple(tupleDesc, values, nulls);
@@ -388,7 +388,7 @@ Datum
hash_bitmap_info(PG_FUNCTION_ARGS)
{
Oid indexRelid = PG_GETARG_OID(0);
- uint32 ovflblkno = PG_GETARG_UINT32(1);
+ BlockNumber ovflblkno = (BlockNumber) PG_GETARG_INT64(1);
HashMetaPage metap;
Buffer buf,
metabuf;
diff --git a/contrib/pageinspect/pageinspect--1.5--1.6.sql b/contrib/pageinspect/pageinspect--1.5--1.6.sql
index d0355b4c7ec..a22438d3c33 100644
--- a/contrib/pageinspect/pageinspect--1.5--1.6.sql
+++ b/contrib/pageinspect/pageinspect--1.5--1.6.sql
@@ -19,14 +19,14 @@ LANGUAGE C STRICT PARALLEL SAFE;
-- hash_page_stats()
--
CREATE FUNCTION hash_page_stats(IN page bytea,
- OUT live_items smallint,
- OUT dead_items smallint,
- OUT page_size smallint,
- OUT free_size smallint,
+ OUT live_items int4,
+ OUT dead_items int4,
+ OUT page_size int4,
+ OUT free_size int4,
OUT hasho_prevblkno int8,
OUT hasho_nextblkno int8,
OUT hasho_bucket int8,
- OUT hasho_flag smallint,
+ OUT hasho_flag int4,
OUT hasho_page_id int4)
AS 'MODULE_PATHNAME', 'hash_page_stats'
LANGUAGE C STRICT PARALLEL SAFE;