Commit Graph

22813 Commits

Author SHA1 Message Date
drh
3d8c92d041 Raise an error on an attempt to rename an eponymous virtual table.
FossilOrigin-Name: c7909e8e0d0577c6109f13c0b14fb565239aae8af8963d659f363e124f3437fc
2021-04-22 18:02:48 +00:00
dan
a5b51b8715 Add the experimental sqlite3session_changeset_size() API.
FossilOrigin-Name: 3de544d495fee553d95fde3fb656745d633138115d25ed39760a1ea7c8c3fae6
2021-04-22 17:55:42 +00:00
dan
6d29a4fe5b Add the sqlite3session_object_config() API. Current used to enable/disable collecting data for sqlite3session_changeset_size().
FossilOrigin-Name: 4d5fd2151e024d11289b6c4fbce2996d8d07b2b5a1c953ef895c237e79d3aa55
2021-04-22 17:40:28 +00:00
drh
65b930553d Improved handling of errors in ALTER TABLE RENAME.
dbsqlfuzz 3e3e2e076e53d02288f80af41a11143a6ddf8c88

FossilOrigin-Name: 9c7a449f52a391506ebf4a8efa4ff27e6e97bd8da4b300a5c0dd942a209fe474
2021-04-22 16:54:34 +00:00
drh
68b63c0195 Fix the date/time translation logic in the zipfile extension so that it
works with boundary cases. See
[forum:/forumpost/d82289d69f|forum post d82289d69f] for the trouble report.

FossilOrigin-Name: c8de5f061359c174e143e5e81ade8aa9b7d71ba57287459cf0f4f2c94459c345
2021-04-22 14:43:16 +00:00
drh
1da9c97bc0 Ensure that the typedefs for specific-length integers in zipfile.c are
correct.

FossilOrigin-Name: f1f2a49007e938ea7a00dda6f8898b1cd38525c0de1e1cac00a7aebcd7b625f5
2021-04-22 13:59:54 +00:00
drh
824043150f In the whereLoopXfer() routine, ensure that the destination is fully
initialized even if an OOM error occurs.

FossilOrigin-Name: c4258708c08c5b1956052f9febbf22c1e94c8352a25059063746921d2cc373b7
2021-04-22 12:38:30 +00:00
drh
31536304a5 The new OP_Null opcode from check-in [8b54102a00852b72] was not coded
correctly.  This check-in attempts to fix that.

FossilOrigin-Name: 02af30aab24878c4382a8863512b816889400104549b51df6a632767fee48d04
2021-04-21 23:13:26 +00:00
dan
a23a873fbb Add the experimental sqlite3session_changeset_size() API.
FossilOrigin-Name: b5564a6fd54875db1de884fdc0e5eeabcd6aa5595ad03a8a60843503e830a2d8
2021-04-21 20:52:17 +00:00
drh
7437c25b63 Add recent dbsqlfuzz test cases to test/fuzzdata8.db.
FossilOrigin-Name: 6fe50dcc239d2d1fc2a38aa705f4c75cbe26b3e48d098537306d96d6a4005659
2021-04-21 12:03:36 +00:00
drh
f02b5ad69d Initialize the key registers in the skip-scan optimization to NULL, in case
the query is run on a corrupt database that causes the initialization of the
key to be bypassed.
dbsqlfuzz 62fdf2bece00d24cac8a4edf2cf562e6eeac779d

FossilOrigin-Name: 8b54102a00852b72783b5b2f336c7a093adbdc8e1b94d46b7d315ae6e5d9476b
2021-04-21 11:58:45 +00:00
dan
fe599b05f2 Fix a problem allowing SQL variables to be used expressions within the second and subsequent ON CONFLICT clauses of an UPSERT within a trigger.
FossilOrigin-Name: 2a28910a17dc5b3ce43062fdf879f9622f6ec2db19ed780fa7fe5cae781be7b7
2021-04-21 11:32:22 +00:00
drh
935ad98d60 Remove a testcase() that is no longer relevant due to the previous check-in.
FossilOrigin-Name: ca70c8ac72c9fe3b92f8e63151229bebdccc769c5c4d603ad4f466dc4bcd11e0
2021-04-20 22:48:25 +00:00
drh
8cae5a4a47 More aggressive detection of database corruption in the rebuildPage() routine.
FossilOrigin-Name: a18c65068b16eae3c0725356d7f4775774b23e248c700cef8c15f23459fba68f
2021-04-20 20:48:15 +00:00
dan
5b482a9832 Update an assert() in btree.c that may fail with a corrupt database.
FossilOrigin-Name: d74bf88c5a027cf080a2892a3538fe5104952b5b3759a6eba1b1a98a75ddf5f4
2021-04-20 13:31:51 +00:00
drh
9da977f1a5 In the sqlite3SelectDup() routine, do not do an incomplete duplication due
to OOM.  This in turn requires several new NEVER() and ALWAYS() macros for
unreachable branches.

FossilOrigin-Name: a61c0e6b78bd39f55464fafd257e68effded64995a66e8fa2d686e8c507ebe43
2021-04-20 12:14:12 +00:00
drh
8c6cb1bc6f Improvement to check-in [d564d8882ef18b55] to detect the OOM fault even
if it occurs deep down inside the duplicated expression.

FossilOrigin-Name: 3e863cd09355abd80c1053d6d4dabb55841f806e3c418f923d67d36bf8313cb0
2021-04-19 20:36:13 +00:00
drh
5e8e7464d0 An improvement to check-in [1a341378ab24a509] that omits the new
Walker.bWalkWinDefn boolean (which is not always initialized) and uses
a special value for xSelectCallback2 instead.

FossilOrigin-Name: bef2238de9550de84d4cd1c970a542b43db288d73d09a3c3ced7f98bb3188fd3
2021-04-19 19:59:16 +00:00
drh
1bb89e9cc8 Ensure that a WITHOUT ROWID table does not have the .iPKey field set, even if
an OOM error occurs while parsing a schema in PRAGMA writable_schema=ON mode.
Add extra assert() statements to triple-check that this never happens.
dbsqlfuzz 803bb1f63d6f3bd6c14db568494d6e96be8f1ec9.

FossilOrigin-Name: 41228350a620a7de1ee748a4e19a96749c4d39418853fe8b68c43cf401dbd7cd
2021-04-19 18:03:52 +00:00
dan
6a4f7f0225 Remove fts5 test functions fts5_expr(), fts5_expr_tcl(), fts5_isalnum() and fts5_fold() from release builds.
FossilOrigin-Name: c68a6c6c898d2acd1f7032ff98f8f3f99eb0b37ffbc6ee88d0dd7badf55a0e0a
2021-04-19 16:45:09 +00:00
drh
60b95335e2 In the query flattener, avoid invalidating an expression if an OOM occurs.
This prevents problems in higher-level routines that might not check for
the OOM after processing a subquery.
dbsqlfuzz fb70fa8602421f87673e0670b0712ff2b5240ea0

FossilOrigin-Name: d564d8882ef18b55ebf93e838426b485281c7ebe3a9b321a2f984ed0f229cc25
2021-04-19 15:05:27 +00:00
dan
0a746cc528 Ensure that all records are updated by setting the OPFLAG_SAVEPOSITION flag when updating records as part of ALTER TABLE DROP COLUMN.
FossilOrigin-Name: 354a4db5cb769c6aed386f43ee26d7e42342e92f781eef100c09751dc5b51751
2021-04-18 05:30:39 +00:00
dan
3c6fbd6dd9 Remove a couple of NEVER() macros from the code for walking window lists.
FossilOrigin-Name: 4ec9ef4bcd12bd9ba5e1a2424f75479070d12c25f1272548c6cf3f89be826b8c
2021-04-17 20:13:53 +00:00
larrybr
68d261d073 Bring in permutations mod.
FossilOrigin-Name: 7a1316f32c857b5ec9e50c5d341f977f998dbf404f4758e3fe317fd8ef25f41e
2021-04-17 20:04:40 +00:00
dan
55f36787ea Do not run external_reader.test as part of permutation "journaltest", as it requires wal mode.
FossilOrigin-Name: 9f5f16cf093cd8b8c7649f664eaf2ad8128fd50e182720dbddf05a6d9227c037
2021-04-17 19:59:14 +00:00
larrybr
f5576936f1 Allow more time for perf tests when instrumented. Condition another on feature it needs.
FossilOrigin-Name: f0dd9cf2d7045d3634294bcf2722d3d7b0a6c4c3ef713b0f7f54fbe31432027f
2021-04-17 18:43:29 +00:00
drh
48a6aede46 Add new dbsqlfuzz cases to test/fuzzdata8.db.
FossilOrigin-Name: d18793e589a4ee7706e994a1f3d24ba7df190467d92fa6ac040258f4debc149d
2021-04-17 18:39:39 +00:00
dan
44918c74cd Fix cases where code in expr.c was failing to handle OOM failures that occurred while processing sub-select expressions.
FossilOrigin-Name: 62efe2eee34fdb147cc456290576d8fc3801487867c78aadd4485f85468d9ffc
2021-04-17 14:42:37 +00:00
drh
7b0d34fe32 Ensure that variables are not used in the WINDOW clause of a query inside
of a trigger.  dbsqlfuzz d9cf66100064952b66951845dfab41de1c124611

FossilOrigin-Name: 1a341378ab24a5091e6cf03b9e957d11b2bfe5c711835e8c583785f8fa0125d3
2021-04-17 13:46:23 +00:00
larrybr
1929cc0d8a Add geopoly to $::sqlite_options() and use it to pass more tests.
FossilOrigin-Name: 23da5016b66f3947cc902dbe2766ea9f5a00f85312a652b536ab51d657446ab7
2021-04-16 23:43:22 +00:00
drh
de0e1b150c Performance optimizations in the code generator, especially in name
resolution.

FossilOrigin-Name: ab83a99899ceae931b43e0c4b3f8f8b83bc832f1568de5692c0d038c968f8a87
2021-04-16 22:53:57 +00:00
larrybr
453954b0de Make a test conditioned on feature used.
FossilOrigin-Name: 31afda7ac3081d05fc9b6d080abeba1296327d0c480bbb4bc5f65c3168cd34ac
2021-04-16 21:29:07 +00:00
drh
188ba3a979 Add new dbsqlfuzz-generated cases to test/fuzzdata8.db.
FossilOrigin-Name: 1ac0a056a07895cc4ae62d01cbba5525402be3af3b8f97fd1dfaba2236ef912b
2021-04-16 19:25:47 +00:00
dan
6c68e55689 Fix another undefined behaviour in fts3 that could follow an OOM error.
FossilOrigin-Name: fac3ff857c4abdb44f59849af80d93a5bd4b64f088e5164fb5ad0be8d14748b7
2021-04-16 17:09:58 +00:00
dan
7f2eb8fff2 Avoid signed integer overflow when finding snippets in fts3 by using 64-bit integer offsets.
FossilOrigin-Name: 4cc09a872f627f4a2b94345bef07cd49c3ec3627f8d78c1eb091741cdb4ec0b3
2021-04-16 16:55:28 +00:00
drh
197561cd42 Remove an ALWAYS() from a branch in sqlite3ExprAddCollateToken() which can
be false following an OOM.
dbsqlfuzz 9e8516bf1e786c84e520ae43141b75b7399f8618.

FossilOrigin-Name: 6af4e6d054efd8445e1010aabd584f36e70dfad0de13bd0e2f1761cad4d9a7d6
2021-04-16 12:33:52 +00:00
drh
19c16c8771 Fix an assert() in whereLoopAddOr() that can be wrong if an OOM occurs in
an OR constraint on a virtual table if one of the terms of the OR is an IN
operator.  dbsqlfuzz 5ee7350b40014f5a878c5d6e76913a2d619f5146

FossilOrigin-Name: 5cb40e53edcb1e54cde0e54c38a647144bc3158435df0161f95c89732de086e6
2021-04-16 12:13:39 +00:00
dan
11a6e9d9f0 Fix an assert() in fts3 that might fail when handing corrupt records.
FossilOrigin-Name: d0e2d6742f314f71562e404980aad20de6b17e0b04c08582c18bbc4fd0360751
2021-04-16 11:25:37 +00:00
drh
81e5a9a6df Fix the comment on the implementation of the pi() SQL function. No changes
to code.

FossilOrigin-Name: 5620bd466eb10fd4daf51af9b88d8221f981dc0ceabfa84a0e1d5c817f635429
2021-04-16 11:05:19 +00:00
drh
34c11e2f4b Do not invoke sqlite3ExprAffinity() if there is a possibility that the Expr
is incomplete due to a prior OOM.
dbsqlfuzz b8a824706914488bd236da51118eb9174ceb870f

FossilOrigin-Name: e8a1515b44380cc52aca1838814ca398012e4e9cf5728d40b404546e812a39b7
2021-04-16 01:03:16 +00:00
dan
9988db8302 Fix a bad interaction between constant propagation and transitive term handling causing patterns like "WHERE unlikely(t1.x=t1.y) AND t1.y=?" to return non-matching rows.
FossilOrigin-Name: 2363a14ca723c0343fbe350f6c19787a7a47c2289fd9af136c97a451b53b5226
2021-04-15 19:09:19 +00:00
dan
37d4ec86bf Add extra test case for OOM handling in where.c.
FossilOrigin-Name: 7163de3dea0445bf25dba47a54c50f35bb5c7edc7bdae9630b51c1ca970ec6cf
2021-04-15 13:26:29 +00:00
drh
d784cc893c Make sure the WhereInfo.pExprMods list is properly cleared when existing
sqlite3WhereBegin() early due to an OOM fault.
dbsqlfuzz 1247a51318047aba42e7f6991dfa62577cb7a151.

FossilOrigin-Name: 0e19af72d84f96245cb4a5cfc37232579b6f5fdebd525f8b6515a4f2cc84e273
2021-04-15 12:56:44 +00:00
dan
385b982865 Prevent an assert() from failing if sqlite3_blob_reopen() is called on a blob-handle that has already hit an SQLITE_CORRUPT error.
FossilOrigin-Name: b5dc7aba036cfd6d09c68dd17608328063634ca99ff341f97bab2dc2a1f59b11
2021-04-14 15:25:10 +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
drh
f817189e1b Fix an assert() in the code generator for expressions so that it is valid
even after an OOM.

FossilOrigin-Name: 427e83eb583a4f63650912f078122e7373fe8c7ea11acfdab464d748b4235261
2021-04-14 11:20:44 +00:00
dan
304cbc17c2 Fix an undefined signed integer overflow in fts5.
FossilOrigin-Name: e6f0adb00da84561e686a8db83858c7fd6b008756dd1aef807ea68f878ca3db7
2021-04-13 17:45:36 +00:00
drh
3bb9d75aa6 Do not leave a WITHOUT ROWID table without a primary key index structure
due to an OOM error.  This prevents downstream troubles in the case of
PRAGMA writable_schema=ON.
dbsqlfuzz 69fb32cc82d59b4d790881566e3f6c727e616122

FossilOrigin-Name: 608b6644b932c4d0c26ab870322639deefde4606f9e335575f99995bc7ed08b5
2021-04-13 13:48:31 +00:00
drh
569143c851 The SQLITE_NoSchemaError flag should not apply to OOM errors while parsing the
schema.

FossilOrigin-Name: 9cc484ad1a42f0821e53be6df46b1811dc8059e5aaf2f6c3e667105a55893b97
2021-04-13 13:20:55 +00:00
drh
6000e08d33 Earlier detection empty_result_callbacks in sqlite3InitCallbac() to avoid
problems with corrupt schemas an writable_schema=ON.
dbsqlfuzz ca4ca43bdb22eab9859de4979aec615af851e111.

FossilOrigin-Name: fb305fe077a0058861427f107957fcc3d2b1443cdd11a7f145df138ca3bb9f4e
2021-04-13 13:01:07 +00:00