Commit Graph

22226 Commits

Author SHA1 Message Date
drh
d321b6f4ad Fix a harmless compiler warning.
FossilOrigin-Name: 3ca0b7d54d73d07cd6b32e650a809174bb1cd66ce5ecdb36f65b70899ea05824
2020-09-01 00:26:21 +00:00
drh
37ccfcfeb9 New test-control that returns the number of calls to
sqlite3BtreeMovetoUnpacked() on the main database and then resets the
counter.  This only works for SQLITE_DEBUG builds.

FossilOrigin-Name: dca5b91926431768babac28a6faf7674a5014db95caba727995b470e92b3182a
2020-08-31 18:49:04 +00:00
drh
c51ceeb049 Fix the documentation for the OP_IdxGT family of opcodes to show that the
P5 operand is not used.

FossilOrigin-Name: 62f7d2a61259f296ffdcb3b3ee1a13925c4563ac8ed669f8a8a63fc7bc3a0a37
2020-08-31 12:29:03 +00:00
dan
acd3c8a995 Fix a sanitizer warning in zipfile.c.
FossilOrigin-Name: ded1a75b3cf39834d38a385f38ae969b296f6c9409856b7eea08645e861b1ac2
2020-08-29 19:00:19 +00:00
dan
d49c0c83ef Improve performance of wal-mode locking on unix in cases where there are hundreds of connections to a single database within the same process.
FossilOrigin-Name: a1c19eea8f141b89a0921da0724096feb21a772ef6654f164e2c36ebf9f7871e
2020-08-29 15:15:07 +00:00
dan
6acdee6765 Fix handling of an xShmLock(SHARED, UNLOCK) call when the caller does not hold any lock on the specified slot, but another connection in the same process holds an EXCLUSIVE.
FossilOrigin-Name: 3eb365027b885e1f61965efd53a3643b6ff441ae01e79038a091314516a50dd4
2020-08-28 20:01:06 +00:00
dan
8337da6678 Modify the unixShmLock() function to avoid iterating through the (possibly large) set of connections to the same database file.
FossilOrigin-Name: e0faddf0dfc3a40b6b94408296dd781dd0264ecc9f2129ce4405438433fb00e0
2020-08-28 19:27:15 +00:00
mistachkin
72c38d87bf Add the miscellaneous 'series' extension to the shell.
FossilOrigin-Name: fc0856dccfab273d50457052fa3c6da768d0eb2504ad04d9540da4e3222fc829
2020-08-28 18:47:39 +00:00
drh
7b8524168e Update Lemon documentation. Patches from sgbeal.
FossilOrigin-Name: f5dc83442bf010bc4083e083b3a1acbb9918b7e685ca676dd899a0e09df196bc
2020-08-28 13:10:00 +00:00
drh
e2678b93af Fix a couple of unreachable branches.
FossilOrigin-Name: f2d26f2b11317abd4f993faa1a4df7afcd1a2d4e448ecc69ca05e9ebf102cd62
2020-08-28 12:58:21 +00:00
dan
832aa023c6 Add fts5 test to confirm that for a table with columns a, b, c and d, "{a b}" and "-{c d}" are handled similarly.
FossilOrigin-Name: 1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
2020-08-28 11:19:49 +00:00
drh
04cd60e18c Remove a (harmless) redundant variable from the CLI implementation.
FossilOrigin-Name: 3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b
2020-08-27 20:55:54 +00:00
drh
92e21ef079 Include the original text of the CHECK constraint in the error message for
anonymous CHECK constraints.

FossilOrigin-Name: 5ce34a955bb36d77edc9951cb7ac2ef9c876d7d3ff5852af682f558e248f428c
2020-08-27 18:36:30 +00:00
drh
359941bd33 Apple the same fix for ticket [9eda2697f5cc1aba] to text-to-integer
conversions that was done for floating point conversions by
check-in [1c76f1d8ec0937a2].

FossilOrigin-Name: aafb7a21041090e529491b0ce30c3902420be0551b1b2c55840a5fbb9105fb7d
2020-08-27 16:28:30 +00:00
dan
ca3ee7e18a Do not attempt to run test script analyze3.test as part of the "prepare" permutation.
FossilOrigin-Name: f7f13cb1bc699c034a3f5f7a2431c8055cb79e2a14d5e70e1fc5dd6dec00fb26
2020-08-27 14:53:47 +00:00
drh
60081a0382 Enhance the ".databases" command in the CLI so that it shows the result
of sqlite3_db_readonly() and sqlite3_txn_state() for each database file.

FossilOrigin-Name: 0ffd16d23dd3b6467cce31af506c70fde44c3796d386c2a03896e43a6d683e60
2020-08-26 19:07:18 +00:00
drh
30497f4169 If the argument to the ".read" command in the CLI begins with "|" then
run the remainder of the argument as a command and read input from the
output of that command.

FossilOrigin-Name: 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492
2020-08-26 10:50:48 +00:00
drh
99744fa4ab Add support for the sqlite3_txn_state() interface.
FossilOrigin-Name: ad195e3dd89d0f33b50070c18fb8f43c4eb24162515dfdd7c04d9e7d96b902a2
2020-08-25 19:09:07 +00:00
drh
58d6f633ba Reduce the N in the logN term for the sorting cost associated with computing
DISTINCT by B-Tree by half, under the assumption that the DISTINCT will
eliminate about half the rows of output.  This is really a wild guess.  But
we do not have any better way of estimating what the row-count reduction due
to DISTINCT will actually be.

FossilOrigin-Name: 8787417ec1da8071d84c6ff0d7a90b5fd458ab6baba871327f36bc4e1bceca61
2020-08-24 23:44:27 +00:00
dan
599456f0ab Correctly handle expressions like "x IS (not) true/false" within the rhs of IN() expressions. Fix for [f3ff1472].
FossilOrigin-Name: 493a25949b9a6d0be82169b597133e491d8be4f4147b6eae135b06c1d810abd3
2020-08-24 10:52:52 +00:00
dan
6c3b4b07d1 Fix a crash that could occur in SQLITE_MAX_EXPR_DEPTH=0 builds when processing SQL containing syntax errors.
FossilOrigin-Name: 5f58dd3a19605b6f49b4364fa29892502eff35f12a7693a8694100e1844711ea
2020-08-20 16:25:26 +00:00
dan
7b14b990d0 Avoid a buffer overrun in test code that could occur if certain test functions were passed a hex-string containing an odd number of digits.
FossilOrigin-Name: 3c5e63c22ffbfeb66eb6ee38912d29fad6f2bd4d74b6a25e89bd36bf40eaa661
2020-08-20 11:03:33 +00:00
drh
14f38b3d0a Try to make SQLite easier to compiler for Mac Catalyst. See
[https://sqlite.org/forum/forumpost/803387a1c5|forum post 803387a1c5].

FossilOrigin-Name: e1595a20d71e61957944cc2b634578968cda8fba08a1f1e75edba20dc9c6080b
2020-08-19 23:51:54 +00:00
drh
46fe138d98 Do not skip over TK_IF_NULL_ROW operators when bypassing TK_COLLATE operators.
Fix to check-in [ac31edd3eeafcef4] which was itself a fix for ticket
[45f4bf4eb4ffd788].

FossilOrigin-Name: 871f2ddcfbb9196dbd851a350e3471ee6d242d86bbd755201f7e2406fce3ac55
2020-08-19 23:32:06 +00:00
dan
1d42e619ac Update releasetest_data.tcl so that the "Fast-One" configuration runs bigmmap.test as part of release testing.
FossilOrigin-Name: a0aa35aaa5694a96638a7c7b1cd69c7523750cbe95831a13c1ee5a6d48256b76
2020-08-19 15:24:19 +00:00
dan
fce445b8fa Fix a problem in test file bigmmap.test.
FossilOrigin-Name: d8e47382160e98be646ce3ba568578493088d1bb11d513ded3e00b576fb07f06
2020-08-19 15:21:52 +00:00
drh
9191c702fc Fix the -quote option on the CLI to set the correct column separator.
FossilOrigin-Name: c778f8295c3c9b6cd6107b33fd7664ae75c97840fc974c9f971755a523f185c4
2020-08-17 09:11:21 +00:00
drh
1d8f892a31 Optimization to sqlite3BeginWriteOperation().
FossilOrigin-Name: 2173d4c6e3addc75964508f2fc8e42755376b3bc285286fa90df4831a6fa280b
2020-08-16 00:30:44 +00:00
drh
45d827cb6a Optimization of the sqlite3SrcListDelete() routine.
FossilOrigin-Name: 1b4acd1ac4a8d24f8804c6d0770f5b0022f569d51742b6954b26e525f04d38ca
2020-08-15 23:48:22 +00:00
drh
289a0c849b Remove more unnecessary sqlite3GetVdbe() calls, replacing them with assert()s.
FossilOrigin-Name: b7dc932197665f0ebde3ffb8f0785c22da07ce307cfd5f0eab69e86e4b38fcde
2020-08-15 22:23:00 +00:00
drh
f0b41745c5 Avoid unnecessary calls to the sqlite3GetVdbe() routine. Add assert()
statements to prove each call is unnecessary.

FossilOrigin-Name: 86d3790caf92e9cb7a9aaaa110f309b4b6945ac30cfd53fc3e5aa1ec3075ada5
2020-08-15 21:55:14 +00:00
drh
398221e2ad Omit the unnecessary not-NULL check on the upper bound of a forward index
range scan.  The subsequent OP_IdxGT will always catch the NULL.  Similarly,
omit the not-NULL check on the lower bound of a reverse index range scan,
as the SeekLE opcode will disallow the NULL.

FossilOrigin-Name: e51ecadcbdef5ce6e41d68412aee70aa4a1416c850358a6fa7e9a1ab443e719d
2020-08-15 19:58:59 +00:00
drh
861889e4f8 When doing an UPDATE or DELETE using a multi-column index where only a few
of the earlier columns of the index are useful for the index lookup,
postpone doing the main table seek until after all WHERE clause constraints
have been evaluated, in case those constraints can be covered by unused
later terms of the index, thus avoiding unnecessary main table seeks.

FossilOrigin-Name: 7fee0b1075d622835dc6828c061be516102da9e2809f52d9ab7c4bbef7dfb871
2020-08-14 21:51:02 +00:00
drh
a3d6d6a93f Update the version number to 3.34.0 for the next development cycle.
FossilOrigin-Name: 70f34f3df5358d36c8578afbc05756450c46da36b8dce339ed87fc0b9d4057cb
2020-08-14 21:37:32 +00:00
drh
f8556d0106 Optimizations to the logic that converts main table accesses into equivalent
index accesses.  Code is now slightly smaller and faster than trunk.

FossilOrigin-Name: 611b640442025e57b8e161f8ddac1f19bd3be9a3d5266f4cef287595c3ed9257
2020-08-14 21:32:16 +00:00
drh
68c0c71065 For UPDATE and DELETE, use OP_DeferredSeek always. If the seek must later
be resolved, add the OP_FinishSeek opcode after all WHERE clause terms have
been processed.  This obviates the need for the WHERE_SEEK_TABLE and
WHERE_SEEK_UNIQ_TABLE flags to sqlite3WhereBegin() and the ensuing
complication, and it allows the covering index optimization to be used
further into WHERE clause processing.

FossilOrigin-Name: a495f60d315e34b1a1bc5fb1336e05047add52c8fb2710b577c97b10a5e734f6
2020-08-14 20:04:26 +00:00
drh
5e6d90fe15 Experimental change to try to get some DELETE operations to access values
using the index rather than the main table, so as to avoid unnecessary
main table seeks.

FossilOrigin-Name: 2f7cb6ab39e54fd6eb3a280d3022c3d4f4ed92e83af7226e63e0199a96397a6b
2020-08-14 17:39:31 +00:00
dan
e0404386f2 Fix an inconsequential memory leak in sqldiff. Update the "Sanitize" case in wapptest.tcl to use -fsanitize=address,undefined, and to run more tests.
FossilOrigin-Name: 613fb5c2525be77e48bad0a74e8b7bf53489365060fb9c7713a0caddb1820c71
2020-08-14 16:14:40 +00:00
drh
ef215fbf3b Version 3.33.0
FossilOrigin-Name: fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
2020-08-14 13:23:32 +00:00
dan
96e337df6b Fix "make test" handling of environment variable QUICKTEST_OMIT so that it can be used to exclude test files in other than the main test directory.
FossilOrigin-Name: b050976079ba4a22d4dfeadb81f40cf71da6588c95bf2b634d88b416de5accd7
2020-08-13 17:27:57 +00:00
drh
a3e6495970 Improvement on the previous fix.
FossilOrigin-Name: f6cffa2d50bfebe5b025f412b7a49b7fdafb798aaf1ddc80e6656ccd1f012a7f
2020-08-12 16:19:12 +00:00
drh
b6a74caf93 Fix an assertion() fault in ALTER TABLE found by OSSFuzz. Test case in TH3.
FossilOrigin-Name: 41de742c5713ab1a0c0c15c44af3ffac40bbc527ae2dc11d829ba9773eb4c84a
2020-08-12 15:39:43 +00:00
drh
c08716a317 Fix harmless USAN warnings from gcc9.
FossilOrigin-Name: 72c4c69fea13f5e24df25645e6941ce3ff896f0a3c73cd63329f819cc907ab40
2020-08-11 21:53:42 +00:00
drh
4dfdb86c8d New test cases for the use of the ieee754 and decimal extensions in the CLI.
FossilOrigin-Name: bc1590f32fc4e2696b4126bd0302cb6405031dd4f55b86f3f1611f7f39299f85
2020-08-11 18:17:04 +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
drh
8c1fbe81d0 Minor comment fixes. No changes to code.
FossilOrigin-Name: 533aeb90085d989078073067172135db98e37e00be84f99757255858126196e4
2020-08-11 17:20:02 +00:00
drh
24c22753fc Remove an unused #define from sqliteInt.h.
FossilOrigin-Name: d5b254f94c1ce6f0f26024d0b9c80e610f7cc891360bc4c2cb116e9eda2874b3
2020-08-11 16:46:21 +00:00
drh
47eb561c40 Simplify #ifdefs associated with Parse.eParseMode. Fix an #ifdef error
associated with SQLITE_OMIT_AUTOVACUUM.

FossilOrigin-Name: 5bbd4bddd3b9fa64d134ed62bce3eb4a09456bf24dec2474b5d764a3a3775964
2020-08-10 21:01:32 +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
26c48d2aab Fix a problem building fts3 separately from the amalgamation.
FossilOrigin-Name: 2a167cfbb2abd76e1b33116b671e58a767fc972dd79bee0004aad09a1dd2b487
2020-08-10 19:30:21 +00:00
dan
12a4c41917 Fix a shell tool build error caused by some combinations of options.
FossilOrigin-Name: 33cd5341ac2ec84c86fbd3371f15c9153f83c1739f85dd8c3956fe2093d49afd
2020-08-10 14:34:36 +00:00
drh
08b9208660 Fix harmless compiler warnings that surface in newer versions of GCC.
FossilOrigin-Name: 9d670a318381f219b467653f5f9539097808b887ae37291ce13be462dedfb18d
2020-08-10 14:18:00 +00:00
dan
ed0af52cb1 Fix another test script problem in walvfs.test.
FossilOrigin-Name: 1b89d3931e368a66be5075bdf49eedd3839591ee268e3ac293040b5bf7639746
2020-08-10 11:21:48 +00:00
dan
80aff0847e Fix minor test script problems.
FossilOrigin-Name: 5d54cd44d076cfede60bd404a59bd700a950420b961ae9fdec4365a3e4ed18ed
2020-08-10 10:43:43 +00:00
drh
14d093f847 Fix a harmless compiler warning.
FossilOrigin-Name: 6f91769fdb0734905f05e1f4d1c81364e6e874450c9f13a0de2259d564f582a7
2020-08-09 17:58:45 +00:00
drh
8afc09dea3 Fix the check-in at [41474548ef3f7454] so that it computes the pointer in
time for error checking at the end of the routine in the case of a non-OOM
error.

FossilOrigin-Name: 13d2fed760e7d0def573c56b7181f45622b0ed78d61952a6de901f96949d074e
2020-08-08 20:15:16 +00:00
dan
07066d90f6 Fix test script busy2.test so that it works with the inmemory-journal permutation.
FossilOrigin-Name: b412d1d175fde9c6402b6fda7c73ac2db2471f2c9416d5c5073549732dea6d98
2020-08-08 20:11:22 +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
drh
c664355c0f Move a pointer computation until after OOM checks to avoid a nuisance USAN
warning.

FossilOrigin-Name: 41474548ef3f7454e44fbf648429730b3f5ba1ff0086fd2f2d0e59b8f51d85e6
2020-08-08 17:55:39 +00:00
dan
a6c13b22b2 Change the name of sqlite3SelectTrace to sqlite3_unsupported_selecttrace.
FossilOrigin-Name: 5ecd03a27b81637ec92af654451a8fff46f1768ddb7c7a443d2a4a933b4475c1
2020-08-08 17:02:39 +00:00
drh
d43c0cbed2 Update requirement marks due to wording improvements in the documentation.
FossilOrigin-Name: bf875a1c7fcb2b41a4d3bd741bb358a635b869d0b6fc9d24385cd5779686d78c
2020-08-08 15:40:42 +00:00
drh
7033ce4fdc Reorder declarations in the decimal extension for C89.
FossilOrigin-Name: eface2da2c0b3daee2a5fd640cca3d3757d0930f62900fc810c50c104635241d
2020-08-08 00:44:45 +00:00
drh
799443b14f Do the oversize-WAL corruption test before the size hint is issued.
FossilOrigin-Name: fdc5fb902d7f2d10f73e64fe30c67153b59b26c5d707fc9c354e90967dbcc214
2020-08-07 19:52:01 +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
b19493434f Add the --checkpoint option to speedtest1.
FossilOrigin-Name: 4cffa9bb44d6f0bdb23cae913adfb224f0814e65a2abb9120179f0b288e70f77
2020-08-07 14:47:55 +00:00
drh
2c40b8f3da Fix compilation issues with MSVC.
FossilOrigin-Name: c5a7e6d2c203ebe5f22ab5c676d33759b542ac57c8bad85d8f561a53bd26917c
2020-08-07 14:22:56 +00:00
drh
f82ce382f9 Fix the columnar output modes in the CLI so that they work with parameters.
See [https://sqlite.org/forum/forumpost/17ba6aac24] for details of the
problem fixed.

FossilOrigin-Name: d573aa9b1299bc25e46fc8a4b4f7c665263490db86c66f11e2d903dcd7071995
2020-08-06 16:45:22 +00:00
mistachkin
cec5f1d127 Fix compilation issues with MSVC.
FossilOrigin-Name: af07d8458ae5e2933134b706f80f9538f011970221904bf9f50ed6e47d306e14
2020-08-04 16:11:37 +00:00
drh
53218e2e2c Back out a NEVER() that turns out to be reachable.
FossilOrigin-Name: 8cf342d4e5eb67b17aee595d9d75f7798eccaebc1ec88e646d344d8d4ab64977
2020-07-31 23:34:53 +00:00
drh
41af5b34bb Remove an ALWAYS() that turns out to be reachable.
FossilOrigin-Name: 12bb75d9edc4c11de58d8b1105b95366c58ac4daaa9ad659499dded89a0d7cb5
2020-07-31 02:07:16 +00:00
drh
1991888238 Test for schema corruption is reachable after all.
FossilOrigin-Name: 2032236cce2ea040dec4cb1c03284bf4882efc1e0158703ab93d8a3451c805a5
2020-07-30 23:47:00 +00:00
drh
e592c18c1c Provide an alternative "guaranteed-safe" method for overwriting the WAL index
on recovery, in case some platform is found for which memcpy() cannot do this
safely.

FossilOrigin-Name: 168cccbabbd4807bdb04953f395cd1a245c46e9d4816a09c9d024ecd5432759d
2020-07-30 22:33:36 +00:00
drh
013e7bb749 Fix compiler warnings in MSVC.
FossilOrigin-Name: 96e3dba2ed3ab0c5b2ecf65a3408633e0767c884d48c270e9ef10ab9fa3ec051
2020-07-30 17:37:49 +00:00
drh
91d028f0a1 Allow for page numbers as large as 4294967294 (0xfffffffe) which means
database files as large as 281 TB.

FossilOrigin-Name: 166e82dd20efbfd355ef3fb8b500bfebd8b946f1b13619b46722de96b57ed039
2020-07-30 17:29:39 +00:00
drh
48bf2d72b9 Fix unreachable branches.
FossilOrigin-Name: 905752da9815ff8242b3cb9a77b1ffdc5cfc76143f47c774890f617a542457a5
2020-07-30 17:14:55 +00:00
drh
8deae5ade3 Fix signed/unsigned compiler warnings.
FossilOrigin-Name: 1d69eee8b085d514f442840346f001b4785f8ec64f5ba66943e9577b26e2e29c
2020-07-29 12:23:20 +00:00
drh
1024822ba8 Earlier detection of out-of-range page numbers in the btree layer.
FossilOrigin-Name: 805bb67a82be51dc6077480691ed815c63a37bd8fc00cf7e67e020349c6e322e
2020-07-28 20:32:12 +00:00
drh
6528bcdc80 Merge enhancements from trunk.
FossilOrigin-Name: 969c25bb14fbd99ca8523abf0ae78a75a3dde539e3323d105690aef4940041eb
2020-07-28 17:51:48 +00:00
drh
9044361a9a If a writer crashes in WAL mode and leave the SHM file in an inconsistent state,
subsequent transactions are now able to recover the SHM file even if there are
active read transactions.

FossilOrigin-Name: ee8a108058c304f9b6b02f84f1da01a0b7a3a21992627bcc1f97d42e8d23da69
2020-07-28 17:29:13 +00:00
drh
e7f3edcd49 Add an sqlite3FaultSim() to make an OOM case more accessible and remove
the ALWAYS() on the conditional that is false when the OOM actually occurs.

FossilOrigin-Name: 2a251af84ff1f5ca281aa69c5410d6ae7aa5a85ef47149909a297525e1651e9d
2020-07-28 17:17:36 +00:00
drh
f31230af12 On recovery, always overwrite the old with the new, even if they are the same.
Add ALWAYS() macros on branches currently thought to be unreachable, pending
additional testing.

FossilOrigin-Name: 7052cf1d533f6404d0f45cf0b3e8a11c1ee27eccb64680a7fd308c8da7cbd544
2020-07-27 20:16:37 +00:00
dan
cddfc3922c Fix a couple of test scripts to match the new wal recovery behaviour on this branch.
FossilOrigin-Name: 3af61e83532f76f0f3252a28663415d37b096ddf05a9c58fa79303933c09abce
2020-07-27 15:05:20 +00:00
drh
8caebb26c5 Improved error reporting if walLockExclusive() fails.
FossilOrigin-Name: cf962d213abe1b55ebbcfecf1de9d5d61709509d1ce3cbd56d8cf4c9ad65e5a9
2020-07-27 15:01:10 +00:00
dan
d3e38b7c0e Allow a wal mode recovery to proceed even if there are readers.
FossilOrigin-Name: 74374aebf9abf3d6b6a3920967a079ceaa4c6276dc6c177682742c2be405b7b7
2020-07-25 20:16:27 +00:00
drh
25a78fdfa2 Merge recent changes from trunk.
FossilOrigin-Name: 22e8e6901a119698de831ede6d8b03c4fd6576eaa8686a97a0b8aeea7593688a
2020-07-24 13:49:38 +00:00
drh
8adc8f1ecb Remove a surplus space from a comment
FossilOrigin-Name: 73fecc688ab5c459245c9bb89432139a083ef378404b4dae3397a7f4e253f72a
2020-07-24 11:01:29 +00:00
drh
0c52f5a2b0 Fix other potentiall pointer aliasing problems associated with subclassing
of the sqlite3_file object for various VFS implementations.

FossilOrigin-Name: 270ac1a0f232d75537be40abae559004e950b992cb2c7e94cd6de66e96ae17bd
2020-07-24 09:17:42 +00:00
drh
d9059bdb5b Fix pointer aliasing problem in the in-memory journal code.
Ref: [https://sqlite.org/forum/forumpost/d44eb2fc44|forum post d44eb2fc44]

FossilOrigin-Name: 892e9191dc8f805678a501db1993437ee99a1e1849496a0a24ceec9b84123257
2020-07-24 09:14:44 +00:00
drh
38f0ccc070 Add the OMIT_ZLIB compile-time option to sessionfuzz.c. (Originally
checked into the wrong branch.)

FossilOrigin-Name: 6019bf8a2db548fea4be4f49961937d5b12eba9e42c7c7a58babfaf3288cb0cd
2020-07-23 18:03:14 +00:00
drh
b140347395 Fix a typo in an error message.
FossilOrigin-Name: 849b03d8de62251707ee0d31c9f1cd98cbd296c70c1a2c8d7c1658840a930fe4
2020-07-23 15:23:53 +00:00
drh
a92eae9751 Merge fixes from trunk.
FossilOrigin-Name: dd39418ee47529cc3ffbe01eccf31f1304a266a196bf81a2a2cb2e650c195b97
2020-07-23 14:27:51 +00:00
drh
2add24c0d4 An ORDER BY clause can slip into an SRT_Upfrom query via the query
flattener, even without the SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time
option.  So always enable the code to deal with that case.

FossilOrigin-Name: 6a3111cd0693bb51191d55a32ecd436341638d54ecb2df0778de681b4969241b
2020-07-23 14:12:47 +00:00
dan
9d44327a83 Fix another case where a corrupt record could cause an assert() to fail in fts3.
FossilOrigin-Name: 28515bbbae4fbc260457dea7a0f7414be1837d6db27fec5514f8da358bfc1f0c
2020-07-23 13:45:47 +00:00
drh
ed109c06e1 Merge support for partial integrity checks.
FossilOrigin-Name: b5443b47af95f4f0ef527bee90f186ee25faa5df197dbcc3e14d48eee095e4aa
2020-07-23 09:14:25 +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
134599e557 Detect out-of-bounds rootpage values in the schema.
FossilOrigin-Name: e4a92688fca31335bf15933dec10ecba04cf340ee2f726fd36d46d4c76660eee
2020-07-22 21:11:10 +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
drh
69306bf43a Improvements to rootpage bounds checking during schema parse.
FossilOrigin-Name: 75599a9731be19e213a8ae174b038a43381bc6883a6b7f4058c2c1625fdea432
2020-07-22 20:12:10 +00:00
drh
3b3ddbae36 When parsing the schema, detect out-of-bounds rootpage values and throw an
error.

FossilOrigin-Name: 6c3a2727dc912ed800146e07db5d15d0f3468d13701165ba763c4b114c3e18e8
2020-07-22 18:03:56 +00:00
drh
584e8b7630 All TCL tests now passing.
FossilOrigin-Name: 4c5f3c6cacf84a36d0347790d98d82d1f584cd1537a13a2736348405c4d20367
2020-07-22 17:12:59 +00:00
drh
bb39ac7773 Most test cases now passing.
FossilOrigin-Name: 92e2ab38930c76811dbf5abfe6b9ea9e12562a4bb4bb06cdb0cf49ac30da0bc3
2020-07-22 13:56:14 +00:00
drh
abc3815860 Continuing work toward supporting unsigned 32-bit page numbers.
FossilOrigin-Name: 9ce1710aad43cebe5ad50859c7685fb83e40cdd4a60913bd2b7e659bc59942fd
2020-07-22 13:38:04 +00:00
drh
55550b7602 Enhance showdb to be 32-bit clean.
FossilOrigin-Name: a8200327d4e8e78abef09c64345e0036f730fbbb20ae88935ef6c9972e6c7d5e
2020-07-22 11:42:50 +00:00
drh
a7982eacd5 Merge fixes from trunk.
FossilOrigin-Name: d2aac001204621062e6cb3230ce2ac1b4545cb83b3ebb6bfebccee4d51162e97
2020-07-22 10:36:49 +00:00
drh
2f04583f04 Work-around for [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270|GCC bug 96270].
FossilOrigin-Name: 9679c0c61131f0e986551701a64191da0ee0f50880eaa57fe4bf520e3fecf634
2020-07-21 18:36:06 +00:00
drh
82b0f106ce Add the sqlite3Int64ToText() routine and use it to convert integers to text,
as it is much faster than the generic text formatter.

FossilOrigin-Name: 14eed318aa9e6e16d1aa13a9f34e3822aa135c39ba06c77df7743509fed6c95e
2020-07-21 18:25:19 +00:00
drh
bbd620e22c Fix the ".read" command so that it gives an error when its argument is
a directory.
See [https://sqlite.org/forum/forumpost/4c53c434ca|forum message 4c53c434ca].

FossilOrigin-Name: 6d258c3c7ecafa1114e4a63739971ff527580868659c2f2c47d2c0adb92c1453
2020-07-20 23:33:11 +00:00
drh
09cf569292 Fix a corner-case error in the new UPDATE FROM logic helpfully discovered
by OSSFuzz.

FossilOrigin-Name: 5cc200939d3a33566ddb858fc74c878acc72cfe5cf4c9b1d08e7b13e4d5ff566
2020-07-20 18:07:35 +00:00
drh
4e6861d23d Add the "enlargedb" utility program used to construct very large database
files for testing.

FossilOrigin-Name: 66858d87507bfdd17bb76c0afb1108ad5dec752438a79bf57f0f51690232e943
2020-07-20 14:54:36 +00:00
drh
a192807c13 Faster column name lookup in the columnIndex() routine using hashing.
FossilOrigin-Name: de2a90812498e504c9b8eeb83bfc48a948b45e87bdfa242c0aa9f0377d90740f
2020-07-20 13:11:19 +00:00
drh
e9261dbd53 Initial changes to allow database up to 281TB in size.
FossilOrigin-Name: 9cb7da9bdb666ea40771513b89591dca275f1e92092b39190df747e3797178a3
2020-07-20 12:47:32 +00:00
drh
51da8daf82 Fix test case result on a DELETE with an INDEXED BY clause due to
improvements in the query planner at [d901837fea1ed54d]

FossilOrigin-Name: 020dbfa2aef20e5872cc3e785d99f45903843401292114b5092b9c8aa829b9c3
2020-07-18 18:59:11 +00:00
drh
a7c74006a0 More harmless compiler warning fixes.
FossilOrigin-Name: 4c0d208c455abb983217a6dfea7634f677f8360fb57857e1421334fe7a5a23e2
2020-07-18 18:44:59 +00:00
drh
aec7dc6563 Fix a harmless compiler warning.
FossilOrigin-Name: 5a0b0c6e11146e200c3417903232e6932102b02d7bf128bac4b7cd74c257acd1
2020-07-18 18:03:26 +00:00
drh
d9674b385c Add UPDATE FROM compatible with postgresql.
FossilOrigin-Name: 88baf1eb0706503214012520be4d872594ccc5b4c9674c44cc07b67ade2bfcf2
2020-07-18 15:52:15 +00:00
drh
387af48ed4 Add ALWAYS() around a conditional that is always true.
FossilOrigin-Name: 270e17bba1d35f8c300844e75b2aa15f79a1ab62e40bc5e6bc9694902f8f7dde
2020-07-17 22:20:23 +00:00
drh
4c0086d7f0 Use #ifdef to omit code that is only reachable when the
SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time option is used.

FossilOrigin-Name: 587ded6035a3ce91db81a29fe34ed30d0e59022cba6f107f25b04d034ef37ba9
2020-07-17 18:07:36 +00:00
dan
07ca7d610b Make it an error to repeat the target object/alias of an UPDATE statement in its FROM clause.
FossilOrigin-Name: d90a37e930c66afe95165955ae47efde08f52c8ce16c4fb239da0233335db050
2020-07-17 16:31:37 +00:00
dan
7e1d9512af Add a couple of "#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT" blocks missing from new code on this branch.
FossilOrigin-Name: cc471df04aecf344d0aa47138014c07d3f93462ae1f8ff86ec5589cfb62c658d
2020-07-17 15:34:54 +00:00
drh
b1c993f681 Relax pointless restrictions on allowing tables in the FROM clause from
crossing over LEFT JOINs, as long as the table being moved is not the
right table of the LEFT JOIN.

FossilOrigin-Name: c1ea064948ba08c4be209ad6efc2126a7367bcb06266ea35eb957bf2d4e2cb9f
2020-07-16 18:55:58 +00:00
dan
9a23d26cba Modifications to test code so that the sqlite3MemdebugHastype() assert() statements are enabled for Tcl tests.
FossilOrigin-Name: e3c423cb1407c06a3806ae6304e4713c37cd446f4cc399731884e3d009938e57
2020-07-16 14:52:24 +00:00
drh
369e758fdc Small performance improvement and size reduction in sqlite3DbStrNDup().
FossilOrigin-Name: 35cd87063d1933b87bc2176f957ecd758d7d167e9473fa615e33caec3be14783
2020-07-16 14:19:57 +00:00
dan
01b2344b3c Add OOM test for UPDATE...FROM statements inside triggers.
FossilOrigin-Name: 917a479b0d11fb59abf41d0317ffc541eb4b83928df9382b4782953c0035fa3e
2020-07-16 10:48:37 +00:00
drh
b866a65d4d Fix a double-free of the FROM clause of an UPDATE inside of triggers.
FossilOrigin-Name: 706c8da2f6d9299f0ad3b3c93332b38071e8e88b4d1660c1841309919b64fd18
2020-07-16 02:36:24 +00:00
drh
6265c47a1a Separate VdbeCoverage() macro for different jumps.
FossilOrigin-Name: da593e57df042527decfea68baacc72d463728544cab81c70fbb25839791f706
2020-07-16 00:45:25 +00:00
drh
525326ef72 Fix a problem in UPDATE FROM in which it tries to free using sqlite3_free()
instead of sqlite3DbFree().

FossilOrigin-Name: 8ca87526523a985674fed5a8770726587b3a2e48d65721916902063ab5dba49c
2020-07-15 21:53:53 +00:00
dan
ac45b7402d Support a FROM clause in UPDATE statements, as postgres does.
FossilOrigin-Name: 7d7d5ecbd70cc39ab7a641ae26af0d3b69d5cb02e626b620102a6e19e7d8a577
2020-07-15 20:01:07 +00:00
dan
e7cf8fdd17 Add tests for UPDATE...FROM and foreign keys.
FossilOrigin-Name: 6c3668f9ed898337e664bec95865f15688a6bba43f095358dda5d08abef2bbaa
2020-07-15 19:38:49 +00:00
dan
576d5a8634 Fix problems that could occur if a table with the same name as the table being updated appeared in the FROM clause of an UPDATE statement.
FossilOrigin-Name: 13224cbd75990615088f3e30ccba05d31b3099fae4300c9ab8f7663bc5f0eb6f
2020-07-15 18:30:01 +00:00
dan
243210b79b Fix a problem in SQLITE_ENABLE_HIDDEN_COLUMN builds occuring when an UPDATE...FROM fired an INSTEAD OF trigger.
FossilOrigin-Name: 5176cb7a6a4e8cfa1973aaae46fcd7d39baedb70ae20bfacc82d62ca39fb0aa3
2020-07-15 15:32:59 +00:00
dan
42d7a77b61 Update this branch with changes from trunk.
FossilOrigin-Name: 53b8b507a10364f5d580655d89c950a5f14c2a8114625fd8749d77f289413b22
2020-07-15 11:00:29 +00:00
drh
d8b3c19991 New test cases for decimal and ieee754.
FossilOrigin-Name: 73d62f82f94347c60e026bc9cb859fec2d8b5f0c756df0c4941f11817234bff8
2020-07-15 02:15:03 +00:00
drh
9951522f0b Improvements to the min()/max() optimization so that it is able to use
indexes where terms are constrained by IN operators.

FossilOrigin-Name: b8ba2f17f938c03543a89dd29d6987163f7a4085a51de1aa14ea5504501c4f72
2020-07-14 23:58:04 +00:00
drh
19543b9b7b Now appears to work. All legacy tests pass. Need to add new tests, however.
FossilOrigin-Name: 81e6450980ee745686aee5e2b84672d3c8404a041c82c658aa562013294b8628
2020-07-14 22:20:26 +00:00
dan
e7877b2d6b Support UPDATE...FROM statements in trigger programs.
FossilOrigin-Name: 4f6d8d0ebf40029218a1d3b05ea657c0c5953b01c6f0b6a628465aa44c67e7f3
2020-07-14 19:51:01 +00:00
drh
c37b7680a4 Fix an obsolete header comment on the sqlite3WhereIsOrdered() routine.
FossilOrigin-Name: 5041f6a1c439b43c654e72a391517c115e222ef0e9a565907b03149b535e92c8
2020-07-14 15:30:35 +00:00
drh
fc5bba7dc1 Merge fixes from trunk.
FossilOrigin-Name: 2af372f59ea250ccf9ab7c30fe4bf8376a5da6e35c401edf643b9a193a38d33d
2020-07-14 13:02:30 +00:00
drh
bc2cf3b295 Early detection of freelist size corruption in incremental vacuum.
FossilOrigin-Name: f25a56c26e28abd44373230c6b5763aed35c9a7648abede8a53409dccc0bee1d
2020-07-14 12:40:53 +00:00
drh
751a44ed24 Fix a crash. Not all tests pass, but tests do at least run to completion now.
FossilOrigin-Name: b5d38e28c62dbc4f5f0e1b2590c9d6c2de9a140cc3528cae1968fd741e337fb0
2020-07-14 02:03:35 +00:00
drh
6e4b140e94 Fix an obsolete assert().
FossilOrigin-Name: 221e021077e2bbce693a89a16361418ced20f4e8f5a27e8c461648cff663a2c5
2020-07-14 01:51:53 +00:00
drh
9d575e46f3 Merge latest changes from trunk. This branch still does not work.
FossilOrigin-Name: 6144387238c03b8b33ae98d624f7ffa44a7829d3e0d4a0a01b5528e71ab4f08b
2020-07-14 01:03:05 +00:00
dan
f067ae8eba Add test for LEFT JOIN in UPDATE...FROM statement.
FossilOrigin-Name: 4f3dff045ab90e80479960fed64cf36f23dd0e13144edbde15043913ad3faac5
2020-07-13 20:43:13 +00:00
dan
be952c11dc Add test cases and fixes for UPDATE...FROM statements that modify primary key columns.
FossilOrigin-Name: 47c87af3e52bce10fbcc2cbe832d659b0c204bfb3368d9314fa1b01120129254
2020-07-13 20:10:29 +00:00
dan
a7f82d9f47 Merge latest trunk changes with this branch.
FossilOrigin-Name: 5ee3c27e20d12a126fb773b428bb864102b949a5b26a8d5c523753dcedf4be10
2020-07-13 18:04:27 +00:00
drh
5b107654e9 Readd the ALWAYS() macro that was removed by [f7a74f89dbd58b47] as the
condition is no longer reachable due to the previous check-in.

FossilOrigin-Name: 9cb03beae42d814a1b1b69f72865fde502d3f443313ec29edd010d1de40225eb
2020-07-13 15:35:08 +00:00
dan
27da907f8e Fix a problem causing queries containing window functions to ignore collation sequences under some circumstances.
FossilOrigin-Name: e6c2192ef88e9990c8b91755c8e779f09e23f936a17123d8e42059257b756ed7
2020-07-13 15:20:27 +00:00
dan
bbc9e1908a Fix an integer overflow bug in fts5 triggered by a corrupt record.
FossilOrigin-Name: 49da8bdce17ced910b414d50e8df79800513dcf03a196197dc1ea8e47deeda92
2020-07-13 11:06:30 +00:00
dan
56215eaff4 Add second test case for the improvement in [30735432].
FossilOrigin-Name: 1bd18ca35bdbf3034591bf8981fd3a985f0920379bc4dc81e0e6a819667998e9
2020-07-11 16:45:20 +00:00