pageinspect provides functions to inspect the contents of database pages at a low level. Useful for debugging and educational purposes. Superuser only.
General Functions
-- Read a raw page (main fork)
SELECTget_raw_page('my_table',0);-- Read from a specific fork (main, fsm, vm, init)
SELECTget_raw_page('my_table','fsm',0);-- Page header information
SELECT*FROMpage_header(get_raw_page('my_table',0));-- Returns: lsn, checksum, flags, lower, upper, special, pagesize, version, prune_xid
-- Compute page checksum
SELECTpage_checksum(get_raw_page('my_table',0),0);
Heap Functions
-- Line pointers and tuple data on a heap page
SELECT*FROMheap_page_items(get_raw_page('my_table',0));-- Tuple data split into attributes
SELECT*FROMheap_page_item_attrs(get_raw_page('my_table',0),'my_table'::regclass);-- Decode tuple infomask flags
SELECTt_ctid,raw_flags,combined_flagsFROMheap_page_items(get_raw_page('my_table',0)),LATERALheap_tuple_infomask_flags(t_infomask,t_infomask2)WHEREt_infomaskISNOTNULL;