pageinspect patch, for showing tuple data
От | Nikolay Shaplov |
---|---|
Тема | pageinspect patch, for showing tuple data |
Дата | |
Msg-id | 4558849.bpshNv4kQh@lenovo обсуждение исходный текст |
Ответы |
Re: pageinspect patch, for showing tuple data
Re: pageinspect patch, for showing tuple data |
Список | pgsql-hackers |
Hi! I've created a patch for pageinspect that allows to see data stored in the tuple. This patch has two main purposes: 1. Practical: Make manual DB recovery more simple 2. Educational: Seeing what data is actually stored in tuple, allows to get better understanding of how does postgres actually works. This patch adds several new functions, available from SQL queries. All these functions are based on heap_page_items, but accept slightly different arguments and has one additional column at the result set: heap_page_tuples - accepts relation name, and bulkno, and returns usual heap_page_items set with additional column that contain snapshot of tuple data area stored in bytea. heap_page_tuples_attributes - same as heap_page_tuples, but instead of single tuple data bytea snapshot, it has array of bytea values, that were splitted into attributes as they would be spitted by nocachegetattr function (I actually reimplemented this function main algorithm to get this done) heap_page_tuples_attrs_detoasted - same as heap_page_tuples_attrs, but all varlen attributes values that were compressed or TOASTed, are replaced with unTOASTed and uncompressed values. There is also one strange function: _heap_page_items it is useless for practical purposes. As heap_page_items it accepts page data as bytea, but also get a relation name. It tries to apply tuple descriptor of that relation to that page data. This would allow you to try to read page data from one table using tuple descriptor from anther. A strange idea, one should say. But this will allow you: a) See how wrong data can be interpreted (educational purpose). b) I have plenty of sanity check while reading parsing that tuple, for this function I've changed error level from ERROR to WARNING. This function will allow to write proper tests that all these checks work as they were designed (I hope to write these tests sooner or later) I've also added raw tuple data output to original heap_page_items function, thought I am not sure if it is good idea. I just can add it there so I did it. May be it would be better to change it back for better backward compatibility. Attached patched is in "almost ready" state. It has some formatting issues. I'd like to hear HACKER's opinion before finishing it and sending to commitfest. -- Nikolay Shaplov Postgres Professional: http://www.postgrespro.com Russian Postgres Company
Вложения
В списке pgsql-hackers по дате отправления: