|
|
|
@ -73,12 +73,55 @@ |
|
|
|
|
test=# SELECT * FROM page_header(get_raw_page('pg_class', 0)); |
|
|
|
|
lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid |
|
|
|
|
-----------+----------+--------+-------+-------+---------+----------+---------+----------- |
|
|
|
|
0/24A1B50 | 1 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0 |
|
|
|
|
0/24A1B50 | 0 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0 |
|
|
|
|
</screen> |
|
|
|
|
The returned columns correspond to the fields in the |
|
|
|
|
<structname>PageHeaderData</> struct. |
|
|
|
|
See <filename>src/include/storage/bufpage.h</> for details. |
|
|
|
|
</para> |
|
|
|
|
</para> |
|
|
|
|
|
|
|
|
|
<para> |
|
|
|
|
The <structfield>checksum</structfield> field is the checksum stored in |
|
|
|
|
the page, which might be incorrect if the page is somehow corrupted. If |
|
|
|
|
data checksums are not enabled for this instance, then the value stored |
|
|
|
|
is meaningless. |
|
|
|
|
</para> |
|
|
|
|
</listitem> |
|
|
|
|
</varlistentry> |
|
|
|
|
|
|
|
|
|
<varlistentry> |
|
|
|
|
<term> |
|
|
|
|
<function>page_checksum(page bytea, blkno int4) returns smallint</function> |
|
|
|
|
<indexterm> |
|
|
|
|
<primary>page_checksum</primary> |
|
|
|
|
</indexterm> |
|
|
|
|
</term> |
|
|
|
|
|
|
|
|
|
<listitem> |
|
|
|
|
<para> |
|
|
|
|
<function>page_checksum</function> computes the checksum for the page, as if |
|
|
|
|
it was located at the given block. |
|
|
|
|
</para> |
|
|
|
|
|
|
|
|
|
<para> |
|
|
|
|
A page image obtained with <function>get_raw_page</function> should be |
|
|
|
|
passed as argument. For example: |
|
|
|
|
<screen> |
|
|
|
|
test=# SELECT page_checksum(get_raw_page('pg_class', 0), 0); |
|
|
|
|
page_checksum |
|
|
|
|
--------------- |
|
|
|
|
13443 |
|
|
|
|
</screen> |
|
|
|
|
Note that the checksum depends on the block number, so matching block |
|
|
|
|
numbers should be passed (except when doing esoteric debugging). |
|
|
|
|
</para> |
|
|
|
|
|
|
|
|
|
<para> |
|
|
|
|
The checksum computed with this function can be compared with |
|
|
|
|
the <structfield>checksum</structfield> result field of the |
|
|
|
|
function <function>page_header</function>. If data checksums are |
|
|
|
|
enabled for this instance, then the two values should be equal. |
|
|
|
|
</para> |
|
|
|
|
</listitem> |
|
|
|
|
</varlistentry> |
|
|
|
|
|
|
|
|
|