Skip to content

Commit a338d65

Browse files
committed
Fix pageinspect's heap_page_item to return infomasks as 32 bit values
HeapTupleHeader's t_infomask and t_infomask2 are defined as 16-bit unsigned integers, so when the 16th bit was set, heap_page_item was returning them as negative values, which was ugly. The change to pageinspect--unpackaged--1.0.sql allows a module upgraded from 9.0 to be cleanly updated from the previous definition.
1 parent 79ad8fc commit a338d65

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

contrib/pageinspect/heapfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ heap_page_items(PG_FUNCTION_ARGS)
170170
values[5] = UInt32GetDatum(HeapTupleHeaderGetXmax(tuphdr));
171171
values[6] = UInt32GetDatum(HeapTupleHeaderGetRawCommandId(tuphdr)); /* shared with xvac */
172172
values[7] = PointerGetDatum(&tuphdr->t_ctid);
173-
values[8] = UInt16GetDatum(tuphdr->t_infomask2);
174-
values[9] = UInt16GetDatum(tuphdr->t_infomask);
173+
values[8] = UInt32GetDatum(tuphdr->t_infomask2);
174+
values[9] = UInt32GetDatum(tuphdr->t_infomask);
175175
values[10] = UInt8GetDatum(tuphdr->t_hoff);
176176

177177
/*

contrib/pageinspect/pageinspect--unpackaged--1.0.sql

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
/* contrib/pageinspect/pageinspect--unpackaged--1.0.sql */
22

3+
DROP FUNCTION heap_page_items(bytea);
4+
CREATE FUNCTION heap_page_items(IN page bytea,
5+
OUT lp smallint,
6+
OUT lp_off smallint,
7+
OUT lp_flags smallint,
8+
OUT lp_len smallint,
9+
OUT t_xmin xid,
10+
OUT t_xmax xid,
11+
OUT t_field3 int4,
12+
OUT t_ctid tid,
13+
OUT t_infomask2 integer,
14+
OUT t_infomask integer,
15+
OUT t_hoff smallint,
16+
OUT t_bits text,
17+
OUT t_oid oid)
18+
RETURNS SETOF record
19+
AS 'MODULE_PATHNAME', 'heap_page_items'
20+
LANGUAGE C STRICT;
21+
322
ALTER EXTENSION pageinspect ADD function get_raw_page(text,integer);
423
ALTER EXTENSION pageinspect ADD function get_raw_page(text,text,integer);
524
ALTER EXTENSION pageinspect ADD function page_header(bytea);
6-
ALTER EXTENSION pageinspect ADD function heap_page_items(bytea);
725
ALTER EXTENSION pageinspect ADD function bt_metap(text);
826
ALTER EXTENSION pageinspect ADD function bt_page_stats(text,integer);
927
ALTER EXTENSION pageinspect ADD function bt_page_items(text,integer);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy