the underlying B-Tree index
access method code. Note that
<function>bt_index_parent_check</function> cannot be used when
hot standby mode is enabled (i.e., on read-only physical
replicas), unlike <function>bt_index_check</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<function>gin_index_check(index regclass) returns void</function>
<indexterm>
<primary>gin_index_check</primary>
</indexterm>
</term>
<listitem>
<para>
<function>gin_index_check</function> tests that its target GIN index
has consistent parent-child tuples relations (no parent tuples
require tuple adjustment) and page graph respects balanced-tree
invariants (internal pages reference only leaf page or only internal
pages).
</para>
</listitem>
</varlistentry>
</variablelist>
<tip>
<para>
<function>bt_index_check</function> and
<function>bt_index_parent_check</function> both output log
messages about the verification process at
<literal>DEBUG1</literal> and <literal>DEBUG2</literal> severity
levels. These messages provide detailed information about the
verification process that may be of interest to
<productname>PostgreSQL</productname> developers. Advanced users
may also find this information helpful, since it provides
additional context should verification actually detect an
inconsistency. Running:
<programlisting>
SET client_min_messages = DEBUG1;
</programlisting>
in an interactive <application>psql</application> session before
running a verification query will display messages about the
progress of verification with a manageable level of detail.
</para>
</tip>
<variablelist>
<varlistentry>
<term>
<function>
verify_heapam(relation regclass,
on_error_stop boolean,
check_toast boolean,
skip text,
startblock bigint,
endblock bigint,
blkno OUT bigint,
offnum OUT integer,
attnum OUT integer,
msg OUT text)
returns setof record
</function>
</term>
<listitem>
<para>
Checks a table, sequence, or materialized view for structural corruption,
where pages in the relation contain data that is invalidly formatted, and
for logical corruption, where pages are structurally valid but
inconsistent with the rest of the database cluster.
</para>
<para>
The following optional arguments are recognized:
</para>
<variablelist>
<varlistentry>
<term><literal>on_error_stop</literal></term>
<listitem>
<para>
If true, corruption checking stops at the end of the first block in
which any corruptions are found.
</para>
<para>
Defaults to false.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>check_toast</literal></term>
<listitem>
<para>
If true, toasted values are checked against the target relation's
TOAST table.
</para>
<para>
This option is known to be slow. Also, if the toast table or its
index is corrupt, checking it against toast values could conceivably
crash the server, although in many cases this would just produce an
error.
</para>
<para>
Defaults to false.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>skip</literal></term>
<listitem>
<para>
If not <literal>none</literal>, corruption checking skips blocks that
are marked as all-visible or all-frozen, as specified.
Valid options are <literal>all-visible</literal>,
<literal>all-frozen</literal> and <literal>none</literal>.