Documentation Source Text

Check-in [95ab7854dd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add documentation for partial integrity_check.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 95ab7854dd800c2c82e8c23ddac369b92ebd6633a9e658c922fe6512fecaeb89
User & Date: drh 2020-07-23 09:32:26
Context
2020-07-26
13:24
Fix typos in the new floating point document. (check-in: e26caafc33 user: drh tags: trunk)
2020-07-23
09:32
Add documentation for partial integrity_check. (check-in: 95ab7854dd user: drh tags: trunk)
2020-07-18
16:35
Documentation for UPDATE FROM. (check-in: ba3810c515 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/changes.in.

22
23
24
25
26
27
28



29
30
31
32
33
34
35
    set xrefChng($vers) $nChng
  }
  incr nChng
}

chng {2020-08-22 (3.33.0)} {
<li> Support for [UPDATE FROM] following the PostgreSQL syntax.



<li> Added the [decimal extension] for doing arbitrary-precision decimal arithmetic.
<li> Enhancments to the [ieee754 extension] for working with IEEE 754 binary64 numbers.
<li> [CLI] enhancements:
    <ol type="a">
    <li> Added four new [.mode|output modes]: "box", "json", "markdown",
         and "table".
    <li> The "column" output mode automatically expands columns to







>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
    set xrefChng($vers) $nChng
  }
  incr nChng
}

chng {2020-08-22 (3.33.0)} {
<li> Support for [UPDATE FROM] following the PostgreSQL syntax.
<li> Extended the [PRAGMA integrity_check] statement so that it can optionally be
     limited to verifying just a single table and its indexes, rather than the
     entire database file.
<li> Added the [decimal extension] for doing arbitrary-precision decimal arithmetic.
<li> Enhancments to the [ieee754 extension] for working with IEEE 754 binary64 numbers.
<li> [CLI] enhancements:
    <ol type="a">
    <li> Added four new [.mode|output modes]: "box", "json", "markdown",
         and "table".
    <li> The "column" output mode automatically expands columns to

Changes to pages/pragma.in.

1698
1699
1700
1701
1702
1703
1704
1705
1706

1707
1708





1709



1710
1711
1712
1713
1714
1715











1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728

1729
1730
1731
1732


1733
1734
1735
1736
1737
1738
1739
1740
    from the returned option names.  See also the
    [sqlite3_compileoption_get()] C/C++ interface and the
    [sqlite_compileoption_get()] SQL functions.</p>
}

Pragma integrity_check {
    <p><b>PRAGMA DB.integrity_check;
      <br>PRAGMA DB.integrity_check(</b><i>N</i><b>)</b></p>
    <p>^This pragma does an integrity check of the entire database.  ^The

    integrity_check pragma
    looks for out-of-order records, missing pages, malformed records, missing





    index entries, and UNIQUE, CHECK, and NOT NULL constraint errors.



    ^If the integrity_check pragma finds problems, strings are returned
    (as multiple rows with a single column per row) which describe
    the problems.  ^Pragma integrity_check will return at most <i>N</i>
    errors before the analysis quits, with N defaulting
    to 100.  ^If pragma integrity_check finds no errors, a
    single row with the value 'ok' is returned.</p>












    <p>PRAGMA integrity_check does not find
    [foreign key constraint|FOREIGN KEY] errors.  
    Use the [PRAGMA foreign_key_check] command for to find errors in
    FOREIGN KEY constraints.</p>

    <p>See also the [PRAGMA quick_check] command which does most of the
    checking of PRAGMA integrity_check but runs much faster.</p>
}

Pragma quick_check {
    <p><b>PRAGMA DB.quick_check;
      <br>PRAGMA DB.quick_check(</b><i>N</i><b>)</b></p>

    <p>^The pragma is like [integrity_check] except that it does not verify
    UNIQUE constraints and does not verify
    that index content matches table content.  By skipping UNIQUE
    and index consistency checks, quick_check is able to run much faster than


    integrity_check.  ^Otherwise the two pragmas are the same.
    </p>
}

DebugPragma parser_trace {
    <p><b>PRAGMA parser_trace = </b><i>boolean</i><b>; </b></p>

    <p>If SQLite has been compiled with the [SQLITE_DEBUG] compile-time







|
|
>
|
<
>
>
>
>
>
|
>
>
>
|





>
>
>
>
>
>
>
>
>
>
>












|
>



|
>
>
|







1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708

1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
    from the returned option names.  See also the
    [sqlite3_compileoption_get()] C/C++ interface and the
    [sqlite_compileoption_get()] SQL functions.</p>
}

Pragma integrity_check {
    <p><b>PRAGMA DB.integrity_check;
      <br>PRAGMA DB.integrity_check(</b><i>N</i><b>)
      <br>PRAGMA DB.integrity_check(</b><i>TABLENAME</i><b>)</b></p>
    <p>^This pragma does a low-level formatting and consistency check
    of the database.  ^The integrity_check pragma look for:

    <ul>
    <li> Table or index entries that are out of sequence
    <li> Misformatted records
    <li> Missing pages
    <li> Missing or surplus index entries
    <li> UNIQUE, CHECK, and NOT NULL constraint errors
    <li> Integrity of the freelist
    <li> Sections of the database that are used more than once, or not at all
    </ul>
    <p>^If the integrity_check pragma finds problems, strings are returned
    (as multiple rows with a single column per row) which describe
    the problems.  ^Pragma integrity_check will return at most <i>N</i>
    errors before the analysis quits, with N defaulting
    to 100.  ^If pragma integrity_check finds no errors, a
    single row with the value 'ok' is returned.</p>

    <p>^The usual case is that the entire database file is checked.  However,
    if the argument is <i>TABLENAME</i>, then checking is only performed for the
    the table named and its associated indexes.
    This is called a "partial integrity check".  Because only a subset of the
    database is checked, errors such as unused sections of the file or duplication
    use of the same section of the file by two or more tables cannot be detected.
    The freelist is only verified on a
    partial integrity check if <i>TABLENAME</i> is [sqlite_schema] or one of its
    aliases.  Support for partial integrity checks was added with
    version 3.33.0 ([dateof:3.33.0]).

    <p>PRAGMA integrity_check does not find
    [foreign key constraint|FOREIGN KEY] errors.  
    Use the [PRAGMA foreign_key_check] command for to find errors in
    FOREIGN KEY constraints.</p>

    <p>See also the [PRAGMA quick_check] command which does most of the
    checking of PRAGMA integrity_check but runs much faster.</p>
}

Pragma quick_check {
    <p><b>PRAGMA DB.quick_check;
      <br>PRAGMA DB.quick_check(</b><i>N</i><b>)</b>
      <br>PRAGMA DB.quick_check(</b><i>TABLENAME</i><b>)</b></p>
    <p>^The pragma is like [integrity_check] except that it does not verify
    UNIQUE constraints and does not verify
    that index content matches table content.  By skipping UNIQUE
    and index consistency checks, quick_check is able to run faster.
    PRAGMA quick_check runs in O(N) time whereas [PRAGMA integrity_check]
    requires O(NlogN) time where N is the total number of rows in the 
    database. ^Otherwise the two pragmas are the same.
    </p>
}

DebugPragma parser_trace {
    <p><b>PRAGMA parser_trace = </b><i>boolean</i><b>; </b></p>

    <p>If SQLite has been compiled with the [SQLITE_DEBUG] compile-time