pageinspect: add tuple_data_record() - Mailing list pgsql-hackers

From James Coleman
Subject pageinspect: add tuple_data_record()
Date
Msg-id CAAaqYe_WVpVBf=j9g3Vg1_y+y9Ff0jfSKpNrAxwcsB1L9Twybg@mail.gmail.com
Whole thread Raw
Responses Re: pageinspect: add tuple_data_record()  (Andres Freund <andres@anarazel.de>)
Re: pageinspect: add tuple_data_record()  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
Background:
In my usage of pageinspect for debugging or other purposes I often find it frustrating that I don't have a way to easily view a heap page's tuple data as actual records rather than binary data. After encountering this again last week while doing some data recovery after an accidental delete (and manually parsing a few int and timestamp fields with get_byte magic) I decided to write up a patch to add a function to handle this case.

Summary:
The new function tuple_data_record() parallels the existing tuple_data_split() function, but instead of returning a bytea array of raw attribute heap values, it returns a row type of the relation being examined.

Status:
The attached patch applies to master and builds cleanly and passes tests locally. It is still WIP (see TODOs below), but is (I believe) functionally complete.

This is my first patch submission, so I encountered a few questions that the coding style docs didn't seem to address, like whether it's preferable to line up variable declarations by name.

After my refactor of tuple_data_split_internal() I'm considering inlining that function (and the similar tuple_data_record_internal() function) into tuple_data_{split,record}(). I'd appreciate feedback on this possibility.

TODO:
- Add documentation.
- Consider inlining _internal functions.

Thanks,
James Coleman
Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: TupleTableSlot abstraction
Next
From: Andres Freund
Date:
Subject: Re: pageinspect: add tuple_data_record()