Commit Graph

34 Commits

Author SHA1 Message Date
drh
7d5a549121 Do not use the one-pass optimization on an UPDATE if there is a subquery
in the WHERE clause, since if the subquery is hidden behind a short-circuit
operator, the subquery might not be evaluated until after one or more rows
have been updated.  Fix for the problem reported by
[forum:/forumpost/0007d1fdb1|forum post 0007d1fdb1].  This is the same
problem that was fixed by [73f0036f045bf371] only for UPDATE instead of
DELETE.

FossilOrigin-Name: 2c56b984a0bd3be5ec326a2109ea7b8f1d4ef63c8fc325caac9663cf2479eaff
2023-03-16 10:17:30 +00:00
dan
4868a86513 Add another test case for the OP_Found fix.
FossilOrigin-Name: 6cdd64a445fe16d547d7bf5ea26dad3ab6d9d5f7d1c2b49fdc9d7a2edaa031c6
2022-11-04 11:59:40 +00:00
drh
093677add4 Enhance the ability of the OP_Found and similar opcodes to detect truncated
index records and report SQLITE_CORRUPT.
dbsqlfuzz 2b12f90aeff8e081706c7e9b58834f04869f446c.  Test cases in TH3.

FossilOrigin-Name: 059a09da2c5fd9c7e723c713565fbaf71602079feef0704129cc5cbbd0033936
2022-11-04 11:54:42 +00:00
dan
5487cdcc0a Update corruptL.test so that it works with SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds.
FossilOrigin-Name: b1bec72043f798f4d4d30e6b60a45ed4dc521115c8a9f97bb8228e3f089deefb
2022-04-26 19:16:11 +00:00
dan
1942d1f236 Avoid an assert() failure in allocateSpace() triggered by a corrupt database. dbsqlfuzz f022eb0ce64d27808574d1dcde5cf7d002dabde8.
FossilOrigin-Name: 2de7f8cc7fe18f0828bb53f1fd11f5eb828faf4d6dfaf39693dff4f8926c1c7a
2022-04-18 15:56:58 +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
larrybr
453954b0de Make a test conditioned on feature used.
FossilOrigin-Name: 31afda7ac3081d05fc9b6d080abeba1296327d0c480bbb4bc5f65c3168cd34ac
2021-04-16 21:29:07 +00:00
dan
8505d73dc0 Fix a potential crash when using json_group_array() as a window function.
FossilOrigin-Name: 3c266690c753d093c2cb74138a46ed69276d85cd119d687a6858c84211e84eaf
2021-04-14 12:11:39 +00:00
dan
91faeec8d0 Modify a test for corruption within the wal checkpoint code to account for the pending-byte page. And for the fact that test configurations might move the pending-byte page.
FossilOrigin-Name: 7dfb74c37e678dde347d9d85846672f82ad282e300e32676330b764be2e4d580
2020-08-11 18:00:10 +00:00
dan
9f567eb9f5 Fix a problem causing test failures in corruptL.test for some permutations.
FossilOrigin-Name: 680bdc6524ad6af0e74401e96e3a576145042fb865c1582bfaffc11d4ff76a4f
2020-08-10 19:35:01 +00:00
dan
47d38e2444 Changes to busy2.test, corruptL.test and fkey5.test so that new test cases pass with all test permutations.
FossilOrigin-Name: d62d1711e2b0f18bb4dfb8899299c8e5b4c8205989b719699da60bcfe1884cf3
2020-08-08 20:03:12 +00:00
dan
35a37c2a47 Fix a test script problem causing an error for SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds in corruptL.test.
FossilOrigin-Name: a85520e0074d574cb4ac5239bb225f8f0b0b3ea1d782cd1cbc79797b4c583fb0
2020-08-08 19:52:53 +00:00
dan
26b9540fc2 Fix a file-descriptor leak in test script corruptL.test.
FossilOrigin-Name: ec2c340c39bc78e4bce0eb01ea408c95ba121103cc77f300f29f3001fc345c20
2020-08-07 18:52:03 +00:00
dan
88819d5870 Return an SQLITE_CORRUPT error if the final expected size of the database when checkpointing is not reasonable - where reasonable is defined (basically) as the sum of the sizes of the database and wal files.
FossilOrigin-Name: e2799563c8a97f617c6d932719b312e3d5bff051a9a397492df8d88e8bb4260a
2020-08-07 16:28:02 +00:00
drh
ca439a4967 Disable rootpage bounds checking when the SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS
setting is off, to facilitate reaching obscure error states during testing.

FossilOrigin-Name: d7dd4fc464c791915f646b1ad228697d1fa16f530fc7d0e9aa702c8df3068c65
2020-07-22 21:05:23 +00:00
dan
56215eaff4 Add second test case for the improvement in [30735432].
FossilOrigin-Name: 1bd18ca35bdbf3034591bf8981fd3a985f0920379bc4dc81e0e6a819667998e9
2020-07-11 16:45:20 +00:00
dan
877859f2d3 Fix an assert() that could fail when operating on a database with a corrupt schema.
FossilOrigin-Name: 4a340c9bc7d939efc947e3b17ca79314482f74368b15567dd089d40e4270890e
2020-06-17 20:29:56 +00:00
dan
759e9cc064 Add a test case for commit [ffd8bb93].
FossilOrigin-Name: bcd5b37b8ebd67537f60c0061fcbc70b2aebebb88d6fb842ccf321a3e20c122c
2020-01-29 13:56:35 +00:00
dan
9a20ea9b5b Improve a specific case of early database corruption dectecion in the b-tree layer.
FossilOrigin-Name: ceacc28b035803342764f9b696c1e80edcd259b87ea4fb46f92963d6cb33de3e
2020-01-03 15:51:23 +00:00
dan
8451e1fa27 Add a test case for the assert() fix in the previous commit.
FossilOrigin-Name: 32fba11ab72f6300391267eaad64e92fa767c289029e668e4bd6c9165acf1487
2019-10-07 13:46:43 +00:00
dan
7971b7fe92 More minor test file fixes.
FossilOrigin-Name: 352878fe1cbcf7b6803624544bba5a95565d1638d4dd09e91764ddad17889301
2019-09-26 20:57:53 +00:00
drh
c5a93d4c85 Validate the type, name, and tbl_name fields of the sqlite_master table when
loading the schema, unless writable_schema is engaged.

FossilOrigin-Name: 724f4df9ccc2b683f7091a3f7a8c20ee210f44d7a610cd1b4c49da1c274add08
2019-08-12 00:08:07 +00:00
dan
0971ef45ab Fix an assert() in the OP_Delete opcode that could fail with a corrupt database.
FossilOrigin-Name: 915388ab39ba3ca8681cd2613b91314aa965967f23a5bface90f54a3d6423300
2019-05-16 20:13:32 +00:00
dan
873b019826 Fix a problem in the new code introduced by [658b84d7] causing corruption and other errors to be ignored.
FossilOrigin-Name: 7ccf2e7d413adb109c61456a5f46e87d38884801dbaab93297a17e3050014b59
2019-05-09 11:19:27 +00:00
dan
a9a5465eb4 Fix an assert() that may be false for corrupt databases.
FossilOrigin-Name: b2ce5ed175cb5029ac07392ae371c86eeec23c74624aad007dee51cf359f3eeb
2019-04-22 11:47:40 +00:00
dan
dcc427cf19 Add an extra test for database corruption to defragmentPage().
FossilOrigin-Name: 80e951fce3e5aaa224c8dba6449832d2efabcdc24e86eb6b7833f85cf08ecc00
2019-03-21 21:18:36 +00:00
dan
fcb02429ec When deserializing a database (sqlite3_deserialize()), do not attempt to parse the schema before the data is loaded.
FossilOrigin-Name: 4e1b005e8b397a22161a6b89cbd3f17bda70a6e0a86d8abdc61856edf2a74da4
2019-03-13 11:40:30 +00:00
drh
8bf4126c84 Change the error message slightly for when two or more indexes have the
same rootpage.

FossilOrigin-Name: 916c52dad414b224695d455a42af36f85dff216504c2aa67d1d2c5818cdca8d6
2019-01-30 19:50:07 +00:00
dan
da7a4c0f7a When parsing the schema, check for duplicate index root page numbers before adding the index to the schema hash table.
FossilOrigin-Name: 6b360bc0b9ad18ccda9d58d43a8388d19999432bfdf294abcf5beb44ef990cb4
2019-01-30 19:12:13 +00:00
dan
56b99ebc32 Add test case for the previous commit.
FossilOrigin-Name: 197edb235b785c68fda7be788efbc61137d9452886599415a927b959ade93c65
2019-01-30 18:47:35 +00:00
dan
ba14c69b4f Fix a couple of assert() statments in btree.c that could fail with corrupt databases.
FossilOrigin-Name: 5eb5e8289fa71e5e29e081d33d4a59c64b463bf6b06d7070c05c46d77d808ad4
2019-01-25 13:42:12 +00:00
dan
b0c4c94996 Fix a potential problem with "INSERT INTO ... SELECT * FROM" (or VACUUM) statements on a corrupted database.
FossilOrigin-Name: db4b4c2c1e9f1adacfb1b2fedb717a4d8bb0a299c3b11835404a99fcd67bf24b
2019-01-24 15:16:17 +00:00
dan
b4738ddb20 Fix an assert() in vdbemem.c that could fire if the database was corrupt.
FossilOrigin-Name: a70958cd7d5cf750c293537856918e5789013b70f6a827f724d83559b38629c8
2019-01-23 20:31:56 +00:00
dan
e6370e9c29 Fix a problem handling a negative value in the "number-of-pages" database
header field. Also a problem with running "REINDEX tbl" against a virtual
table for which the SQL passed to sqlite3_declare_vtab() contains PRIMARY KEY
or UNIQUE constraints.

FossilOrigin-Name: 556dd8922f65af93084ee725c638b8dc696b611dd508c212a3b507d6ca474031
2019-01-11 17:41:23 +00:00