Commit Graph

136 Commits

Author SHA1 Message Date
drh
9b4e7898d7 Add a test case to the fix to PRAGMA integrity_check in the previous check-in.
FossilOrigin-Name: 39a57b596d309d9e2d4c59409fe5d36e0665781ce0307d157ff8b6e883161bbb
2024-05-02 12:00:36 +00:00
dan
f8dc7d20f7 Have "PRAGMA quick_check" compare the number of entries in tables and indexes.
FossilOrigin-Name: b736519d3d2e93c76fa36253143f2664b9dd12e26acba555f0bf9c4d44705499
2024-02-27 11:03:10 +00:00
drh
95b5295f52 Fix a bug in PRAGMA integrity_check introduced by enhancement (8a) in
[https://sqlite.org/releaselog/3_42_0.html|release 3.42.0] and first reported by
[forum:/forumpost/ee4f6fa5ab|forum post ee4f6fa5ab].

FossilOrigin-Name: 460353dfff8f2fb03f9c8666d0c367ec7be4cfa96dfcb0cea10f144d043223bb
2024-02-13 18:41:46 +00:00
dan
d90ecb5d6e Have "PRAGMA quick_check" compare the number of entries in tables and indexes.
FossilOrigin-Name: cc294c041b4c7a044ff344989f872415ced5263a0b654112371b2da7c852a688
2024-02-02 16:51:24 +00:00
drh
e5ea81ae85 Improved error messages from PRAGMA integrity_check. Identify the root of
the tree when a problem is found in a b-tree, making it easier to track the
problem to a specific table or index.

FossilOrigin-Name: a1cb152e69c7c6cdd99300c91a8104716089de459d9d19e33ef38432aad70908
2023-04-01 13:14:53 +00:00
drh
3594b2b303 Do not allow constant factoring during PRAGMA integrity_check, since the
constants might be stored in registers that are later reused for other
purposes.  dbsqlfuzz dc9ab26037cf5ef797d28cd1ae0855ade584216d.  Problem
discovered by a new assert() statement added in [6f8b97f31a4c8552].

FossilOrigin-Name: 0bba27b78112b2b2271e498f41c437df985aa2faab302ee5b29d9b60003a8379
2023-03-27 13:24:02 +00:00
dan
e734207a79 Fix some test scripts that were failing with SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: 81c118d90b281b30f40b3eeefaeb2c8350aa40080b4fe7de8f21d263986c6acb
2023-02-06 10:47:57 +00:00
drh
d0fe0fc531 Enhance PRAGMA integrity_check so that it verifies that the string values
stored in indexes are byte-for-byte identical to the values in the table, and
not just equivalent according to the collating sequence.
dbsqlfuzz 686e2e205e0c0594d3fb524bea0c25e621d1a870.

FossilOrigin-Name: 9302e4bfdce5905576b8f0af7d6b3a864e1dcd58ed89bb303010a1c4f826e915
2023-01-04 15:18:52 +00:00
drh
7e475e571f Disable the ability to change the schema_version cookie when
SQLITE_DBCONFIG_DEFENSIVE mode is enabled.  This is a security
enhancement inspired by the question in
[forum:/forumpost/2b9cc3dae1f1e5f6|forum post 2b9cc3dae1f1e5f6].

FossilOrigin-Name: 1d81381e8f5db5d7064cc313b8544ca3cb1ca9e8cd61e71368a2d2e598befc9c
2022-11-12 17:17:01 +00:00
dan
37f3ac8faa Change things so that SQLITE_OMIT_VIRTUALTABLE implies SQLITE_OMIT_ALTER_TABLE.
FossilOrigin-Name: 2f7c946c5f25a858167f5193ca06e53310394c8cff15426ab8a1327a1ec835fd
2021-10-01 20:39:50 +00:00
drh
c2df4d6adb Recognize certain standard datatypes ("INT", "INTEGER", "REAL", "TEXT", and
"BLOB") and if a column has one of those datatypes, store the type part of
the bit-field information in the Column structure to save space.

FossilOrigin-Name: d2da62a9df63036b02dadca3798de9e623c2680b3ef0c37d2b18bb88693afd7f
2021-07-30 23:30:30 +00:00
drh
17d2d592fb Add the ability to do a PRAGMA integrity_check (or quick_check) on a single
table by specifying the table name as the argument.

FossilOrigin-Name: 65dd321432e8f80bc1cb11be8ca06656b41ac997a74a5eb271c797cf0fbb764e
2020-07-23 00:45:06 +00:00
drh
5f419b3bba Update requirement marks due to changes in documentation wording.
FossilOrigin-Name: 326cdc16f4db23c1d17596e4ef8d9d7abc672d48665950029ba53fd40c1b2d99
2019-09-27 17:36:37 +00:00
dan
b84b38fd89 Add test cases to improve coverage of VDBE branches. Still some to go.
FossilOrigin-Name: 4cef609d61de272cfdc2b39e1d49c7cd56ec834086bd63095116ff98f4d402bd
2019-04-04 17:58:34 +00:00
drh
6ab91a7a7a Add the SQLITE_DEFAULT_DEFENSIVE compile-time option. Fix up test cases
so that they work with DEFENSIVE enabled.

FossilOrigin-Name: 3212733cb6d1a59516d67a86df7c7b1d2456a1b2e5d7080c26b0e87b2609c65d
2018-11-07 02:17:01 +00:00
drh
efeaec365f Updates to test procedures so that they all work with encryption. No changes
to the core SQLite code.

FossilOrigin-Name: 0481330756e861de8e1eb7136e7dca2f333b2a82377949d2e0eba401af7d73dd
2017-10-23 16:34:07 +00:00
drh
d33bcb8a3c Improvements to PRAGMA integrity_check for better detection of malformed
records.  Integrity_check now avoids returning SQLITE_CORRUPT on a corrupt
record.  Also includes microoptimizations that I stumbled over while working
on integrity_check.

FossilOrigin-Name: 8525c30c1d6676e51b9d9c642450aae3722c129edafdbc39b8435fcfe09b1817
2017-09-13 00:33:36 +00:00
drh
74588ceb31 PRAGMA integrity_check returns SQLITE_OK even if it encounters corruption
while scanning indexes.

FossilOrigin-Name: 81f62e99f27dedf3dc10fa1593c4cd9fc158680867206aee853e503a0cc8df71
2017-09-13 00:13:05 +00:00
drh
3e1e14d818 Make sure all connections are closed in the pragma.test script.
Test change only - no changes to code.

FossilOrigin-Name: d7b7f038a2c5e81a58c1dd4b556096b58ce10c30eb74fd4b770445927fdb62f3
2017-09-12 00:24:45 +00:00
dan
3841372350 Update "PRAGMA integrity_check" to detect inconsistencies between a single
record's header and body.

FossilOrigin-Name: 9e393a0edf1a578ddecc16a72fe3c54b75c2a650d507bcbc37c9724fbede1494
2017-09-05 20:16:19 +00:00
drh
a690ff360b Change the error message text for SQLITE_ERROR to omit the part about
"missing database" as that meaning is now obsolete (since approx SQLite 2.0).

FossilOrigin-Name: 732f90d6327c5c6368fc8b4cc207bd644ef08e3ae6d2e7295258ab099deaba63
2017-07-07 19:43:23 +00:00
drh
518aca114f Merge updates from trunk.
FossilOrigin-Name: cc28106e5c196c0a9678fbbd06f6afd49271a8e8
2016-04-21 15:03:37 +00:00
drh
a6dddd9bde Remove quotes from identifiers used as datatype names in a CREATE TABLE
statement.  Fix for ticket [7d7525cb01b68]

FossilOrigin-Name: eba27d4d17a76884292667d570d542e580ee3e77
2016-04-18 15:46:14 +00:00
dan
9131ab9386 For a pager backed by a temp file, store the main journal in memory until it is at least sqlite3_config.nStmtSpill bytes in size. Prevent the backup API from being used to change the page-size of a temp file.
FossilOrigin-Name: 84c557010c211595d2ec80b62c63af1c7f4714bd
2016-04-06 18:20:51 +00:00
drh
7da56b4f65 Many more test cases fixed. Only a few remain.
FossilOrigin-Name: 99b9d7eef68fd6d5c9eecb5fbe3dfe002c1ca4a8
2016-03-14 18:34:42 +00:00
drh
6841b1cb3d Add "PRAGMA synchronous=EXTRA" which syncs the directory containing the
rollback journal when the rollback journal is deleted in order to commit a 
transaction in DELETE mode.

FossilOrigin-Name: af92401826f5cf49e62c278f344ab75252a18da2
2016-02-03 19:20:15 +00:00
drh
b3366b99c8 Update evidence marks due to wording changes in requirements text. No
changes to code.

FossilOrigin-Name: 86781093bdb4c4fdedd228cb1c8961db48a483bb
2015-09-11 20:54:44 +00:00
drh
d99d28361e Ensure that semantic SQL errors are always reported back up to the syntax
parser.  Also:  Improve the defense against invalid PRAGMA synchronous settings.

FossilOrigin-Name: 7aeade9a07f29bf26e50394042ea18d0121fe7a3
2015-04-17 15:58:33 +00:00
drh
59ac655d02 Silently ignore requests to change the PRAGMA synchronous setting to an
illegal integer value, rather than raising an assertion.

FossilOrigin-Name: e0a88176fcfbed7b554a036948261a332c920053
2015-04-16 16:04:39 +00:00
drh
1b6789697d Remove an incorrect ALWAYS() from the table_info pragma.
FossilOrigin-Name: 0e087c0183bc7a758cf2a1d39158bc24fde833a2
2015-04-15 07:19:27 +00:00
drh
7be0fd9c58 New test cases and requirements marks for PRAGMA index_info, index_xinfo,
and index_list.

FossilOrigin-Name: e5b13634d9794e4c75378cea89b64c5ecc5aa3e5
2015-03-05 15:34:15 +00:00
drh
5e7028c210 Revert "PRAGMA index_info" to output only three columns, for complete
compatibility with prior versions.  The new "PRAGMA index_xinfo" can be
used to get the extra information in 4th, 5th, and 6th columns.

FossilOrigin-Name: fc543c2c5ced30a7dc3a05b0c1ad80fdc838df8e
2015-03-05 14:29:02 +00:00
drh
51a74d4cbd More test cases and requirements marks for pragmas.
FossilOrigin-Name: fc51037cd97063069620213a62efdeff5d898706
2015-02-28 01:04:27 +00:00
drh
9d356fbe6e New requirements marks and a few new test cases to go with them. No changes
to code.

FossilOrigin-Name: 8c2b29d9acb92d47f4deec21a7c2dca52db63345
2015-02-27 20:28:08 +00:00
drh
4bb8cb0927 Merge all recent trunk changes, including the movement of the pragma
table into the separate pragma.h header file.

FossilOrigin-Name: 3af19f84446ba5fc1ed754d0d73f6a6d7fb2f365
2015-02-04 23:13:48 +00:00
drh
c228be5b1f Add the "index_xinfo" pragma. Add new columns to the "index_info" and
"index_list" pragmas.

FossilOrigin-Name: 30f51d7b3b292191e8351223242e708bb7f3dfa6
2015-01-31 02:00:01 +00:00
drh
7efa426ee9 Make sure the sqlite3BtreeCount() routine does not leave index cursors in an
inconsistent state, as doing so might result in an assertion fault inside
of sqlite3BtreeKey() called from saveAllCursors() if content is deleted out
from under the statement that issued the sqlite3BtreeCount() call.

FossilOrigin-Name: 5b1b697040116048e464b3ebab8395fe088e389a
2014-12-16 00:08:31 +00:00
drh
2d8233157d Fix a benign test error on PRAGMA collation_list
introduced by a recent checkin.

FossilOrigin-Name: 332cc9591d05508ac9cb56fde2b82e20e0342d1f
2014-11-20 23:11:30 +00:00
drh
cefc87fca5 Enhance the PRAGMA integrity_check command to detect UNIQUE and NOT NULL
constraint violations.

FossilOrigin-Name: 9abcf2698c09f4f6a44a68e74f9f6b538f3253d6
2014-08-01 01:40:33 +00:00
dan
597515d70c Update some test cases that deal with corrupt databases.
FossilOrigin-Name: 3a09f5605ac7c6e503eb10acfdc607010414d917
2014-02-28 18:39:51 +00:00
dan
1fed5dab0d Attempt to speed up sqlite3VdbeRecordCompare() by various means. This code is in an interim state.
FossilOrigin-Name: 85206e0bbac29adab52bef795f6d1479f2ae2c0e
2014-02-25 21:01:25 +00:00
drh
6fbe41acf2 Continue working to get UPDATE operational for WITHOUT ROWID tables.
Fix PRAGMA integrity_check so that it works on WITHOUT ROWID tables.

FossilOrigin-Name: 0d4fea7462c0f61cd1c736cbcd7bea5ec2034d54
2013-10-30 20:22:55 +00:00
drh
3ef261567a Restore the index_list pragma back to its former operation. Create a new
PRAGMA stats used to access the table and index widths and heights.

FossilOrigin-Name: f0cf8c85dcbcc7778aed2816792c368d777f79cb
2013-10-12 20:22:00 +00:00
drh
833d198fb1 Fix test cases for the new information in PRAGMA index_list.
FossilOrigin-Name: dd03be1065537679c2daf5e4200902c47714fceb
2013-10-08 22:25:22 +00:00
drh
fdaac671b8 Improved estimates of the relative speed of index scans based on declared
datatypes of columns in the table.  Add "r" column to PRAGMA index_info,
showing the estimated relative scan rate.

FossilOrigin-Name: 07462bb6059f023c22a6c84a4a02afbd84e69255
2013-10-04 15:30:21 +00:00
drh
4ee09b4bcc Allocate 4 bytes of unused header space for an "Application ID". Add
the "PRAGMA application_id" command to set and query this identifier.
Add the "magic.txt" file to show how the posix file command might use
this application id.

FossilOrigin-Name: 28c9e7fdee2471a3026ee05ff591194d5f398131
2013-05-01 19:49:27 +00:00
drh
c95e01da22 Verify that the schema has not changed before running PRAGMA table_info,
index_list, index_info, and foreign_key_list.

FossilOrigin-Name: 82952d08f3e3aa80a7f51e80dbc89742cb4a09f0
2013-02-14 16:16:05 +00:00
drh
384b7fe221 Enhance the table_info pragma so that the pk column shows the order of the
columns in a multi-column primary key.

FossilOrigin-Name: 3076a89015071e9b40e728bd55160e3a6ed98820
2013-01-01 13:55:31 +00:00
dan
5885e76269 If a specific database is nominated as part of a "PRAGMA integrity_check" or "PRAGMA quick_check" command, search for problems in the nominated database only. i.e. "PRAGMA main.quick_check" now only scans the main database, not all attached databases as before.
FossilOrigin-Name: 4353e40b74f577f224f190c429bfe03cf6a5c6d6
2012-07-16 10:06:12 +00:00
drh
cc71645bf7 Merge the changes need to compile on WinRT into trunk.
FossilOrigin-Name: 61360ca6ca3448477d5c662d3642beef6dd2079e
2012-06-06 23:23:23 +00:00