Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/pageinspect.sgml`
9d15e487406f492c5a075f6577de1a8221f0dd959c09a21b0000000100000fab
 as argument.  For example:
<screen>
test=# SELECT * FROM heap_page_items(get_raw_page('pg_class', 0));
</screen>
      See <filename>src/include/storage/itemid.h</filename> and
      <filename>src/include/access/htup_details.h</filename> for explanations of the fields
      returned.
     </para>
     <para>
      The <function>heap_tuple_infomask_flags</function> function can be
      used to unpack the flag bits of <structfield>t_infomask</structfield>
      and <structfield>t_infomask2</structfield> for heap tuples.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <function>tuple_data_split(rel_oid oid, t_data bytea, t_infomask integer, t_infomask2 integer, t_bits text [, do_detoast bool]) returns bytea[]</function>
     <indexterm>
      <primary>tuple_data_split</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      <function>tuple_data_split</function> splits tuple data into attributes
      in the same way as backend internals.
<screen>
test=# SELECT tuple_data_split('pg_class'::regclass, t_data, t_infomask, t_infomask2, t_bits) FROM heap_page_items(get_raw_page('pg_class', 0));
</screen>
      This function should be called with the same arguments as the return
      attributes of <function>heap_page_items</function>.
     </para>
     <para>
      If <parameter>do_detoast</parameter> is <literal>true</literal>,
      attributes will be detoasted as needed. Default value is
      <literal>false</literal>.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <function>heap_page_item_attrs(page bytea, rel_oid regclass [, do_detoast bool]) returns setof record</function>
     <indexterm>
      <primary>heap_page_item_attrs</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      <function>heap_page_item_attrs</function> is equivalent to
      <function>heap_page_items</function> except that it returns
      tuple raw data as an array of attributes that can optionally
      be detoasted by <parameter>do_detoast</parameter> which is
      <literal>false</literal> by default.
     </para>
     <para>
      A heap page image obtained with <function>get_raw_page</function> should
      be passed as argument.  For example:
<screen>
test=# SELECT * FROM heap_page_item_attrs(get_raw_page('pg_class', 0), 'pg_class'::regclass);
</screen>
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <function>heap_tuple_infomask_flags(t_infomask integer, t_infomask2 integer) returns record</function>
     <indexterm>
      <primary>heap_tuple_infomask_flags</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      <function>heap_tuple_infomask_flags</function> decodes the
      <structfield>t_infomask</structfield> and
      <structfield>t_infomask2</structfield> returned by
      <function>heap_page_items</function> into a human-readable
      set of arrays made of flag names, with one column for all
      the flags and one column for combined flags. For example:
<screen>
test=# SELECT t_ctid, raw_flags, combined_flags
         FROM heap_page_items(get_raw_page('pg_class', 0)),
           LATERAL heap_tuple_infomask_flags(t_infomask, t_infomask2)
         WHERE t_infomask IS NOT NULL OR t_infomask2 IS NOT NULL;
</screen>
      This function should be called with the same arguments as the return
      attributes of <function>heap_page_items</function>.
     </para>
     <para>
      Combined flags are displayed for source-level macros that take into
      account the value of more than one raw bit, such as
      <literal>HEAP_XMIN_FROZEN</literal>.
     </para>
     <para>
      See <filename>src/include/access/htup_details.h</filename> for
      explanations of the flag names returned.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </sect2>

 <sect2 id="pageinspect-b-tree-funcs">
  <title>B-Tree Functions</title>

  <variablelist>
   <varlistentry>
    <term>
     <function>bt_metap(relname

Title: PostgreSQL Heap Inspection Functions
Summary
The pageinspect module provides functions for inspecting heap pages, including heap_page_items, tuple_data_split, heap_page_item_attrs, and heap_tuple_infomask_flags, which allow superusers to examine tuple data, attributes, and infomask flags, and optionally detoast attributes as needed.