pageinspect: add tuple_data_record()

From: James Coleman <jtc331(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pageinspect: add tuple_data_record()
Date: 2018-10-17 01:39:02
Message-ID: CAAaqYe_WVpVBf=j9g3Vg1_y+y9Ff0jfSKpNrAxwcsB1L9Twybg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
tuple-data-record-v1.patch application/octet-stream 12.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-10-17 01:46:59 Re: pageinspect: add tuple_data_record()
Previous Message Andres Freund 2018-10-17 00:02:42 Re: TupleTableSlot abstraction