1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-04-20 08:47:46 +03:00

611 Commits

Author SHA1 Message Date
stephan
5d60f47001 Approximately 50 typo fixes, spanning the whole tree, contributed via [forum:006c8fa165083ac3|forum post 006c8fa165083ac3] and individually checked for correctness. Affects only code comments, docs, and a single line of debug output in a test app.
FossilOrigin-Name: af928818a030924060ee0762431dae0f16d53a62f4e1132754d052eb9c621ac2
2025-02-25 20:55:14 +00:00
dan
5087eacb18 Ensure the counts of "deferred FK violations" and "deferred immediate FK violations" are kept separate when "PRAGMA defer_foreign_keys" is used.
FossilOrigin-Name: c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2
2025-02-13 14:47:25 +00:00
drh
35d302ccb1 Increase the maximum number of arguments on an SQL function to 1000 with the
capability to increase it further up to 32767 using a compile-time option.

FossilOrigin-Name: e8d7d68ba0bb0bc2f948db5d9966990a5d23597fc3658b7cd0bc99d53c7353a9
2024-12-12 15:11:27 +00:00
drh
ef636cc3cd Add the SQLITE_PREPARE_DONT_LOG option for sqlite3_prepare_v3(), that prevents
errors in the compilation of the SQL from being sent to sqlite3_log().

FossilOrigin-Name: 870403425493866232cf9e8fa62288861b7d0a4091b15d75727f8bb31da46f94
2024-12-06 18:35:16 +00:00
drh
bc4df6079c Remove the never-used and never-documented and long-ago deprecated
user-authentication feature option.

FossilOrigin-Name: 3a3f7bf4307c27e56546e51da06ecc9a262cdf155fda2dd359aa2326d207a147
2024-10-28 17:27:15 +00:00
dan
29f976432a Fix an assert() failure in "PRAGMA integrity_check" that could occur when checking a corrupt database.
FossilOrigin-Name: d218993be5886f07193d5c2a66ccd0ecdd7bb87687947b89945c90e31cea5451
2024-10-07 11:47:05 +00:00
dan
a40cae7802 Ensure successive scans of pragma virtual tables return consistent rowids.
FossilOrigin-Name: 6838bf3ac130c5862f5fbc718b3e49ece154fa840b6539af2616cffa31e73808
2024-05-07 17:58:07 +00:00
drh
78bc1339ac Do not accept a string that looks like a number used as an argument to
PRAGMA integrity_check as a number.  Treat it as a table name that just
happens to look like a number.

FossilOrigin-Name: b04e7a23478f1012e501a810f3e09cca81a66e802f5f72cae80c81120174e2cb
2024-05-02 11:52:31 +00:00
drh
41c9945c74 Use the SQLITE_CONSTRAINT return value from xBestIndex to prohibit bad
query plans in the pragma virtual table.

FossilOrigin-Name: b1259d4448f744861e416f42328c1450854370e5c77102d2a5abe5cf6c7f12bd
2024-03-25 11:34:42 +00:00
drh
cf84ae0189 Fix the xBestIndex method of the pragma virtual table so that it correctly
gives a higher cost to plans where the schema hidden parameter is
unconstrained.  Fix for the problem reported by
[forum:/forumpost/85b6a8b6705fb77a|forum post 85b6a8b6705fb77a].

FossilOrigin-Name: bc516ff5202ee6e9834266bf755fe26e30ac557dcc7975ca7a06dfe33874fcd2
2024-03-24 21:10:45 +00:00
drh
2aea6083bd Adjust a VdbeCoverage() macro in PRAGMA integrity_check to account for the
fact that arguments to the OP_Eq opcode used are never NULL.

FossilOrigin-Name: 759ccea3f6e21493c0153f884b601988efd59e409b113b28f8cf23f59a74e418
2024-02-27 16:36:40 +00:00
drh
39670a5345 Remove unreachable branches from the PRAGMA integrity_check enhancement of
[b736519d3d2e93c7].

FossilOrigin-Name: 6d02fb233fb86f9907cc374d06a7ed71a638091d6e75abc199001c42eab51e5c
2024-02-27 15:33:54 +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
9591a9f069 Fix typo in comment. [https://fossil-scm.org/forum/forumpost/cc20266bf2|Fossil forum post cc20266bf2].
FossilOrigin-Name: 7e3c46eed1290964a3e25662686c6ba1149bf8687d05719b684772e65d660c09
2024-02-21 20:21:46 +00:00
drh
21eda699d7 Fixes to comments associated with the recent PRAGMA optimize enhancements.
No changes to code.

FossilOrigin-Name: 27a2113d78b35e324e9aedda7403c96c56ad0bed8c6b139fc5a179e8800b9109
2024-02-20 15:38:36 +00:00
drh
4b2eeb289b Remove an unused variable from the merge in the previous check-in.
FossilOrigin-Name: 5c26bf379e18e28d800525bd03e2d5597e2f37674979302f351b99abfc064749
2024-02-20 13:10:46 +00:00
drh
4189c44cff Another simplification of the PRAGMA optimize logic for improved coverage.
FossilOrigin-Name: 6c5a0c85454e3c658e51fab611c169c034447174022eebc52fd8619b528a4765
2024-02-20 12:14:07 +00:00
drh
ae71fa5d59 Minor fixes.
FossilOrigin-Name: ed5afebc410e3d430e2428d35f027bffb218e5f11036a42f97b080153e89016e
2024-02-19 23:58:26 +00:00
drh
a1507a3fa0 Fix a minor hiccup in the computation of the number of btrees to be scanned.
FossilOrigin-Name: 91302d9b2720d6b5184e1c24db55d351544adfde4b3d2ddcdc1561f79f11985a
2024-02-19 20:47:59 +00:00
drh
9a28311b6a If there is no mention of a table in sqlite_stat1, use OP_Rewind to see if
the table is empty prior to invoking ANALYZE.

FossilOrigin-Name: 0cc93b19de597866292e0696f89fbd0e22a6cbb374678f5cc096fb889210fe3c
2024-02-19 20:12:30 +00:00
drh
74b0aad09f In PRAGMA optimize, scale back the analysis_limit when many different tables
and indexes must be scanned.

FossilOrigin-Name: 636615358aebfef80a657d09f15f608df9e64882b2aaa5574ce31a4f1c71fd70
2024-02-19 19:56:40 +00:00
drh
e7bdb2172c If a table has one or more rows and it has a partial index has zero rows,
still make an entry in the sqlite_stat1 table for the partial index, so that
we know that "PRAGMA optimize" does not need to redo the whole table.

FossilOrigin-Name: e147b18991dd462fff367442acb0504fdf193a31843ed34ec8c1ced30747bf8a
2024-02-19 16:22:58 +00:00
drh
6c6356f7f2 Simplifications to PRAGMA optimize to make it easier to use. It always
tries to ANALYZE unanalyzed indexes.  The 0x10000 flag just makes it check
for size changes in all tables.

FossilOrigin-Name: 44ed7f4cd07a88a2fdd303a2c78e6babe01d7344b399bd2b80ed68d75a77aaa2
2024-02-19 13:50:09 +00:00
drh
9f34a05e98 Change the 0x20000 bit (use analysis limit) to 0x10, meaning that this feature
is on by default.  The default analysis limit is changed to 2000 which is
almost always sufficient for accurate analysis results.

FossilOrigin-Name: 4abd47b5917099a2f74e53e12c987da0722304a5e9a93b6d43015c1f45c48444
2024-02-19 13:06:27 +00:00
drh
d43e7adca7 Hold a transaction during PRAGMA optimize, for performance.
FossilOrigin-Name: d13b79eae6df7f9d1f3b8062ddc75a12ff038196b3d752d2672a9925fa45ca56
2024-02-18 01:12:22 +00:00
drh
42eb6a91cd Add new MASK bits to PRAGMA optimize: 0x70000.
FossilOrigin-Name: dd4497062569eec9ddfdaa7d6394c83ff40a7a59c6697a161bc4ff6d8af3bb29
2024-02-17 16:39:52 +00:00
drh
837efb4cbe The PRAGMA optimize command invokes ANALYZE if a table shrinks by 25 times
in addition to if it grows by 25 times.

FossilOrigin-Name: 40532ffba91cf332c1ea4add80184031a9d6e10514d2d9b9a6cfd613091b81f7
2024-02-17 01:12:58 +00:00
drh
9d00aba895 Rename the TF_StatsUsed flag to TF_MaybeReanalyze, to more accurately
reflect its usage.  No logic changes.

FossilOrigin-Name: b4790da5e0d6f0f617e6c3a17fc2606842e41cab14339392abd335410fec0aa3
2024-02-16 12:57:04 +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
drh
0f777cd622 Fix an #endif (added in the wrong place by [8f4b1ceafe4a271b]) so that
the build works with SQLITE_OMIT_VIRTUAL_TABLE.

FossilOrigin-Name: 7070924eebce1d089fde911dc0427ab8f3764d57ace24caff2b79954b42d1b51
2024-02-07 20:45:38 +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
64b76c0ed4 In PRAGMA integrity_check, defer running xIntegrity on virtual tables until
after all ordinary tables have been checked.

FossilOrigin-Name: 8f4b1ceafe4a271b23e17493a244a34c1732a3d35c5533c37394b9f3dc158435
2024-02-01 14:57:24 +00:00
drh
2ba5534101 The assertion change at check-in [7946c79567b0ccd3] is insufficient to fix
the problem of a Table object being deleted out from under the OP_VCheck
opcode.  We need to reference count the Table, which is accomplished here.

FossilOrigin-Name: cad269d5e274443c39203a56603b991accc0399135d436996fc039d1d28ec9db
2023-11-29 02:45:09 +00:00
drh
9f20bde65a Enhance the new xIntegrity method of the sqlite3_module object with new
parameters that provide the name of the table being checked and
a flag to indicate a "quick_check".  Based on feedback in
[forum:/forumpost/965c0d02ea|forum post 965c0d02ea].

FossilOrigin-Name: bc8afa3f15954bb35f65dbf940bf069de5e14d333036676c24430cf17b658d05
2023-10-25 10:37:11 +00:00
dan
3f81c3264a Add an SQLITE_OMIT_VIRTUALTABLE block around the new vtab code in "PRAGMA integrity_check".
FossilOrigin-Name: ab99eb2b6c50f4f0bb42918b9bdda37e2ef9316bed07de18fa4bd373c49a8b00
2023-10-23 11:34:24 +00:00
drh
76bd238a66 Replace the patch at [5cb61c6788d7c017] with a better way to avoid failing
PRAGMA integrity_check if a module implementation is not loaded, as the use
of suppressErr can lead to problems.

FossilOrigin-Name: be5737ee4f4f1d5f8b3126f6eb70210bf3d8b1cdaef51aae818eaaba43ccf722
2023-10-21 20:03:44 +00:00
drh
81656b15c9 Fix PRAGMA integrity_check so that it does not raise an error if the
schema contains a CREATE VIRTUAL TABLE that does not have its module
loaded.

FossilOrigin-Name: 5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82
2023-10-20 19:06:04 +00:00
drh
9817065340 Actually prevent PRAGMA writable_schema=ON from being set in defensive mode,
rather than just preventing it from functioning.

FossilOrigin-Name: 2b574d9e7e922d0961ea27bfc0148d3098157ff8d4feefba469489c81d43f3e0
2023-10-13 12:57:23 +00:00
drh
5dc4a405c5 Make sure virtual tables have been connected before trying to invoke
the xIntegrity method during PRAGMA integrity_check.

FossilOrigin-Name: 4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da
2023-10-12 20:51:17 +00:00
drh
1935887a68 Ensure that all fields of static sqlite3_module objects are explicitly
initialized, in order to hush-up nuisance compiler warnings.

FossilOrigin-Name: f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7
2023-10-06 12:51:05 +00:00
drh
9e5d21092d Fix unreachable branches.
FossilOrigin-Name: f00fc16394427f25249dd58c25a9115fef1ae389e232d574b4e91db2e7f8c04d
2023-09-06 16:22:48 +00:00
drh
961c2a9f36 Add the xIntegrity method to the sqlite3_module object. Implement this
method in RTREE, FTS3/4, and FTS5 so that "PRAGMA integrity_check" also
verifies the correctness of shadow tables associated with those virtual
tables.

FossilOrigin-Name: 17bede8cdefd968210dd8a5a2617acbe12ba2c99fdd5e88c5def8665e7bec2d7
2023-09-06 12:52:00 +00:00
larrybr
55be21647e Fix straggler misspellings and tidy the custom dictionary. Also include pickups from [forum:/info/c61fb09afd|forum post c61fb09afd].
FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
2023-06-07 17:03:22 +00:00
larrybr
bc91738e66 Add a C-source spell-checking facility. make misspell (on Nix)
FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
2023-06-07 08:40:31 +00:00
drh
df542e0500 Enhance PRAGMA integrity_check so that it can detect that a NOT NULL column
contains a NaN value and report that as an error.
dbsqlfuzz f144b642fe6f1a1c196f258ac6e60118a0cb59b2.

FossilOrigin-Name: 7638d9755dc90fd353b874d03ed418fa8aaee4440290ff69b1b552eae84e5baa
2023-03-29 11:36:24 +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
drh
aa9192e6aa Improvements to register allocation, especially in the ANALYZE command.
New assert() statements added to help verify that memory allocation is
correct, and to help fuzzer find lingering errors.

FossilOrigin-Name: 6f8b97f31a4c8552312b4c98432ea356ae54c06d9cc929969f50c3c88360cd7b
2023-03-26 16:36:27 +00:00
drh
fe52615925 Fix a vdbe-coverage macro added by [f418bdd627e84e7d].
FossilOrigin-Name: 77f559d2647615379fed55ced5d69ae90515273e59811b92171bdd3089c90a22
2023-03-03 19:56:19 +00:00
drh
1b9db7f32d Enhance PRAGMA integrity_check so that it can detect when there are extra
bytes at the end of an index record, which might cause OP_IdxRowid to
malfunction.  dbsqlfuzz c1aa3986534d5feab8d21f28b3c1712df2ef358ba.  Test case
in TH3.

FossilOrigin-Name: f418bdd627e84e7d494f730d7124d8f4846ebcde031f5b2498685c9aceebb3c8
2023-03-03 18:35:00 +00:00
dan
20438431c8 Fix a problem causing "PRAGMA quick_check" to return spurious corruption errors for a WITHOUT ROWID for which all columns are either virtual or part of the primary key, and for which the order of the columns in the primary key definition is different from the order in the table.
FossilOrigin-Name: a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470
2023-01-28 17:37:37 +00:00