Commit Graph

18356 Commits

Author SHA1 Message Date
dan
514c4b7e5d Merge latest trunk changes into this branch.
FossilOrigin-Name: 985bfc992950625a45a7521bf4c8438cd0170de974dff976968be158ac5922a9
2017-11-01 07:06:41 +00:00
dan
176b2a916b Fix a race condition in os_unix.c that might allow a client to use a *-shm
file corrupted by a power failure if another client fails between locking the
*-shm file and truncating it to zero bytes.

FossilOrigin-Name: d655bfabd110999b6808073c334869c5b6a8334df56811df883e47e56d3f1cbb
2017-11-01 06:59:19 +00:00
drh
24fa4d57a7 When sqlite3_checker finds a problem, show the row key as part of the error
message, not the row index number.

FossilOrigin-Name: 6ffe917d10e298cd80cd3a8c8c5116a2819145a176fb8cfccd5dbd88b10f39df
2017-11-01 01:05:41 +00:00
drh
1fae37319e Actually perform index checks when running sqlite3_checker
FossilOrigin-Name: 54530020260ea9e4cfd021f5ffccb74d78c469b717dce377d3df6eaf84b63719
2017-11-01 01:01:20 +00:00
drh
4e8ad3bc14 Begin putting functionality into the sqlite3_checker binary.
FossilOrigin-Name: e82e883b93128e4d1105a82abe8d1860c0a15505b6ca421e187b9bbbc2fdc659
2017-11-01 00:10:34 +00:00
drh
1884d00dd0 Merge all recent enhancements from trunk.
FossilOrigin-Name: 24adf90ffb3ce9ff3c26efef0357f3a47312e8d11dc391ef2cc7e6873ef25895
2017-10-31 18:15:36 +00:00
drh
927dd51fce Add the checkfreelist extension to the sqlite3_checker binary.
FossilOrigin-Name: 0c22f0d6d19e595c0577b0bad416522e71647f54d2eb5cda587e2ccc5f63dd6a
2017-10-31 18:09:40 +00:00
drh
2091f0fb3e Fix an error in the Makefile.msc for the sqlite3_checker.exe target.
FossilOrigin-Name: 49d0c6f1f62dccc3c4609760950f7b28bf94a9520996a80d10ff45096b0dd9a0
2017-10-31 15:55:48 +00:00
drh
2737fa0376 Add build infrastructure for the sqlite3_checker command-line utility.
FossilOrigin-Name: 429e3c3c85d6b677038be93567f93e69eb756442bb421bb02ee5d5d69290fa09
2017-10-31 15:49:19 +00:00
drh
d59fde3da5 Update the built procedures for the sqlite3_analyzer utility to allow it
to be linked with an external sqlite3.o library.  Automatically detect a
missing dbstat extension and report the compile-time error.

FossilOrigin-Name: bb39744f4b2b25c10d293e85db7579e2a99c639fdab45e93d1de75952b68b2de
2017-10-31 14:56:44 +00:00
drh
6f09910779 Fix redundancies in the makefiles that resulted from moving shell.c over
to shell.c.in.

FossilOrigin-Name: bf09fa683ea42b7552bd2f29ab5371bd175f0055cf9a453e6f8c6f4408cd168f
2017-10-31 12:20:43 +00:00
drh
183f0aa6c4 Fix a minor comment typo. No changes to code.
FossilOrigin-Name: 5f79e6d9c3d44b0cc7cf805429006f7b29a69e8d863b58472172a56b29a7bb4e
2017-10-31 12:06:29 +00:00
dan
7eded5925b Fix a couple of issues in incremental_index_check to do with CREATE INDEX
statements that contain embedded SQL comments.

FossilOrigin-Name: 2aef41815a9f1786ebdf09d8f6cfa59a8e7d733253eafeae24fa6e2a093bb1d8
2017-10-31 12:01:01 +00:00
drh
9d9c41e25e Remove unnecessary NEVER() and ALWAYS() conditionals.
FossilOrigin-Name: 1c80c75d4be2f3d44fb18bb4c07eccac2aba79b688215a741317dfc47dc7c2ce
2017-10-31 03:40:15 +00:00
drh
666fb6914d Add the showshm utility program for printing out the shm header in a
human-readable format.

FossilOrigin-Name: f6304fd142c998aba44f02c6018223af2630671b4791d750b70a59ab1adb8d6d
2017-10-30 23:25:06 +00:00
drh
07dae088b9 Clarify some comments describing the WAL index file. No changes to code.
FossilOrigin-Name: 3be3aad9ecbe33060cfa9c6059b9206ed221d1fd72a69c355a9387f9f4e075e7
2017-10-30 20:44:36 +00:00
dan
e7a579d27d Add support for indexes on expressions to incremental_index_check.
FossilOrigin-Name: 8c1c701fdbe0d56ee7f6f7d7b583aafde9fa14acc93ee8ecaddc8bb311e2bf52
2017-10-30 19:38:41 +00:00
drh
eba21f9eb2 Improve the performance of the LIKE operator by using strcspn() to aid
wildcard matching.

FossilOrigin-Name: 37284d4e8f501a37c582aa899419a3dfe0932e2a8e2ef2fdf59addd1d3cdacb4
2017-10-30 18:49:11 +00:00
dan
75650d4f94 In checkindex.c, use C code instead of SQL/group_concat() to compose various
SQL clauses. This is to make it easier to support indexes on expressions.

FossilOrigin-Name: 940606b3af059eb3f79d71fec871ea88df8bce0349f5b33b79c147a85610e269
2017-10-30 17:05:18 +00:00
dan
6fc6617909 Fix an issue in incremental_index_check with indexes that use non-default
collation sequences.

FossilOrigin-Name: 3ebb2351e2650d263029d2c0042683cba3529c9d3f76b5f994f2e737b84d3f67
2017-10-30 08:04:38 +00:00
drh
b68db3187b Increase the version number for the next release - which is still months
away but there have been significant query planner enhancements since the
previous release.

FossilOrigin-Name: 457eedfac0ff652912c4cfb89682acb3d2e372ef00745139adf8492a0b61fa09
2017-10-28 20:54:51 +00:00
drh
fca23557fe Reactivate query flattening when the result set of the outer query has
no function calls or subqueries.  This is a partial reversal of 
check-in [c9104b59].  Co-routines are still preferred if the outer
query has a complex result set, but for simple results sets, query flattening
is used.  Check-in [4464f40ccd7] is completely backed
out due to this change.

FossilOrigin-Name: d17ef7d153058f7332b3fec421ade42c67e26b06f36fc1629e6799537a5afc5f
2017-10-28 20:51:54 +00:00
dan
19465e7380 Fix "after" parameter handling in the incremental_index_check code.
FossilOrigin-Name: c40c3c62e996044f31ca49ffc2edb2cc0320e69956f7ee6fe3e9012200e0d9a0
2017-10-28 20:31:25 +00:00
drh
6d6e76f75f Add test cases from OSSFuzz to prevent a regression in co-routine
processing.

FossilOrigin-Name: 689743d8e3fa81e65dcb067bbf61bab09210b3b39586c865c00d9f1d6692daf2
2017-10-28 12:20:09 +00:00
dan
bde13e2694 Add the start of the "incremental_index_check" virtual table in
ext/repair/checkindex.c. For incremental verification of index contents.

FossilOrigin-Name: d5b9dada471358a2864727759648b763bf6890fc2521fac53c0d8216017d39b7
2017-10-27 20:53:16 +00:00
drh
0503f2acfa Fix a Pager ref-count leak in the sqlite_dbpage virtual table.
FossilOrigin-Name: c063bb04da77d6847e4e254b6bb939c860e781382e34ddff8e0454d9db7552e2
2017-10-27 18:24:11 +00:00
mistachkin
b4bab90b31 Handle the Ctrl-C event for the shell on Win32.
FossilOrigin-Name: c8aaf37117ed4a23bbd15dc481788735efcb77bff98be423eca3521c0a9270de
2017-10-27 17:09:44 +00:00
drh
6e61c5f895 Additional test case demonstrating the ability to access structure elements
using quoted names in the JSON1 extension.

FossilOrigin-Name: 8d3cc928a8f0c7b2616c5c75af9d3a50bd4f0fe8e4ccab545ab8648cbfbb4b7f
2017-10-27 12:27:25 +00:00
drh
47d9f83982 Enhance the min/max optimization so that it works with indexes on
expressions.

FossilOrigin-Name: 6caec9082b3ad6d3f89f6291084a8f5c80f296630e2e94bc764389ac1a47a833
2017-10-26 20:04:28 +00:00
drh
7ea11066b6 Extra ".selecttrace" output following aggregate analysis. No changes to
production builds.

FossilOrigin-Name: 6fbf74ab3189b9cb20cf7cc8db0226eb935a8eab477cc83b8390492fcf2f1f76
2017-10-26 18:43:19 +00:00
dan
ab04eff809 Fix an error in the previous commit on this branch.
FossilOrigin-Name: f71dfee06ce1e0eee760cfca19482bdec7729d6c7d28f10f4cfd21e1f92a04b0
2017-10-26 17:34:50 +00:00
dan
9181ae990a Instead of extra locks, use F_GETLK to ensure that readonly_shm clients cannot
connect to a wal-mode database if there are no writers.

FossilOrigin-Name: 5492f457dc7cc5c416de4b4e61e84bd2f10b4e6ce54011b7a60feb47f629c923
2017-10-26 17:05:22 +00:00
dan
4544e28425 Fix a bug causing "make amalgmation-autoconf" to create an invalid package if
either the current or parent directory contains a file named install.sh or
install-sh.

FossilOrigin-Name: e1faa7859451ee969f0ce02d2d4e4c54d0e2e018b37b8faf690e6b87593cce7d
2017-10-26 15:21:56 +00:00
drh
b5039fb7d3 Use extra locks to prevent a readonly_shm=1 process from connecting to a
WAL-mode database if there are no writers.

FossilOrigin-Name: 35d979082b4ab36d6a8975f8f15a50e69f46b72a173164d2b353377b9f758bd8
2017-10-25 23:28:13 +00:00
drh
3cd8aaa748 Fix the sqlite3_dbpage virtual table so that it can read and write from
any attached database.

FossilOrigin-Name: d4f893e1ae53a0445939ea2920af87d21dd36270494381028b2eaebe5c188f18
2017-10-25 19:18:33 +00:00
dan
7e2b38c53b Add tests cases and fix minor issues in the rtreecheck() function.
FossilOrigin-Name: d6130cd226c0ca95e02f0cbabfdc27071acdcf83e0d0cb0eaa47d992479ed9a1
2017-10-25 18:17:24 +00:00
mistachkin
2c0d084400 Add SQL scalar function rtreecheck() to the rtree module. For running checks to ensure the shadow tables used by an rtree virtual table are internally consistent.
FossilOrigin-Name: 7d26498063bbc4525976ace698fafcf161d939908f4ffb36d7a4df8fb1bce1fb
2017-10-25 18:01:58 +00:00
mistachkin
8c66e5b73e Fix compilation issue (C99-ism) seen with MSVC.
FossilOrigin-Name: 61870b42b033189509b244c76d28932f7a447b887ffe04a3c81461148e54cfb5
2017-10-25 18:00:58 +00:00
dan
1917e92fdb Add SQL scalar function rtreecheck() to the rtree module. For running checks
to ensure the shadow tables used by an rtree virtual table are internally
consistent.

FossilOrigin-Name: dde0bb3eab1316c3247b1755594527ca70955aab4ad4907190731f7ec092b327
2017-10-25 16:38:34 +00:00
drh
b5d013edd1 Do not reference the ioctl() system call in the unix backend unless it
is actually needed by the Batch Atomic Write extension.  This should allow
the build to work on VxWorks.

FossilOrigin-Name: adfa7ed2de3e833fff65935455e71236a59602aaf7b97ece667ab300dca9f673
2017-10-25 16:14:12 +00:00
drh
98d529b541 Add the sqlite_btreeinfo eponymous-only table for introspecting the schema
and estimating the sizes of various btrees.

FossilOrigin-Name: 1e30f4772db1e1086096f72d32e87c552923be8b264aa13cf822fae754eb083d
2017-10-25 01:34:24 +00:00
mistachkin
ea78f64dc1 Force the autoconf makefile for MSVC to always use the 'find.exe' included with Windows.
FossilOrigin-Name: b76bffd332585e8412a0a994ae6dee79a83213d8b709d7f858c5c05678ab0887
2017-10-24 21:17:12 +00:00
drh
e2f3b671ed Merge all of the fixes from the 3.21.0 release.
FossilOrigin-Name: 5ab662b443df17c5ebdadc0bdac2f447c5c7e86f7a32a6943bb4ac8605879441
2017-10-24 19:05:26 +00:00
drh
39f2b329f6 Version 3.21.0
FossilOrigin-Name: 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827
2017-10-24 18:55:49 +00:00
dan
952523f618 Fix a problem in the incr-blob code causing a new cursor to be opened for
every sqlite3_blob_reopen() call.

FossilOrigin-Name: 41ef34a1f0650c50cacb203665cd9d57db53a49c979bf0d5a78937517f763a2c
2017-10-24 17:28:25 +00:00
drh
f7902a543e On the amalgamation package, enable the sqlite_dbpage virtual table so that
the .dbinfo command works in the CLI.

FossilOrigin-Name: 54b90b4f27f6f213825e881929fa04a6282e5b909a12e881366f9aef6872dcb6
2017-10-23 21:24:38 +00:00
dan
685bea66ce Merge trunk fixes to swarmvtabfault.test and the lsm extension into this
branch. No changes to core SQLite code.

FossilOrigin-Name: f632b87002a7ee9be569aacb5ce85bb7e9c86b7d77bb8d1bf8b55eb5be4ecc77
2017-10-23 20:20:42 +00:00
mistachkin
0295774ca0 In the 'swarmvtabfault' test module, make sure to close the database handle prior to raising an error from the 'not found' callback script.
FossilOrigin-Name: f317037b31b19007e30bb41c54506d9d241a6d590c2b31e2ddda10d4f6e7605b
2017-10-23 20:17:19 +00:00
mistachkin
15dd780a9e Cleanup a test database file prior to using it.
FossilOrigin-Name: e1bf5e1d06dbe573671c6b5472b45f5bfa3cf82374f70a76b4c80815bf15a29b
2017-10-23 17:36:52 +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
dan
21cd29ab15 Avoid passing a NULL value as the second argument to memcpy().
FossilOrigin-Name: 58e5bb491bc0e28412ca188ba8fbe94adc67b5b1e9d7c112c36011400528d577
2017-10-23 16:03:54 +00:00
dan
b5ef728db6 In lsm (not SQLite), avoid opening the *-shm file before the database file is
locked. Otherwise, there is a race condition whereby a connection in another
process process may unlink() it while it is still in use.

FossilOrigin-Name: c8b8b9b573665c2b4d278bb679a48ac407374b8d860f0c3f4d50a303043464ad
2017-10-23 11:48:00 +00:00
dan
104a3b18b4 Fix minor test script problems revealed by releasetest.tcl.
FossilOrigin-Name: c333ee7e9677bda1dad8e80cf94755350bfe20bc0754577442727b6f807ad831
2017-10-23 07:53:00 +00:00
dan
f970372698 Fix minor test script problems revealed by releasetest.tcl.
FossilOrigin-Name: 15e87d9bc81812fb9de86f9870389217dddb9f9c4d48e42acefce2d35ba293f1
2017-10-23 07:52:07 +00:00
dan
123e1b5be5 Fix test cases in dbpage.test so that they work with
SQLITE_DEFAULT_AUTOVACUUM=1 builds.

FossilOrigin-Name: 9474f061d634721ca462bbad375270b8b39dea44011df3e1aac72021e8bf70fc
2017-10-22 08:03:39 +00:00
dan
063cf17a11 Fix test cases in dbpage.test so that they work with
SQLITE_DEFAULT_AUTOVACUUM=1 builds.

FossilOrigin-Name: 0fcf1e61ef2b6c1fb8f4846f973d2d427598ffbc80dbc49e56e71513b194bae7
2017-10-22 08:02:56 +00:00
dan
f4af5dbae4 Avoid running tests that use sqlite_dbpage with SQLITE_OMIT_VIRTUAL_TABLE
builds.

FossilOrigin-Name: 6dde8d6154c5b4d36c7aad17d6eaafdb13c66a09d17d4c79f52b2417846ea0b5
2017-10-22 07:58:09 +00:00
dan
9499b4a614 Avoid running tests that use sqlite_dbpage with SQLITE_OMIT_VIRTUAL_TABLE
builds.

FossilOrigin-Name: 7bd20a20a0f422765a6e469d1a1b67b95c4a441931688e04a2b1b491a5238528
2017-10-22 07:57:29 +00:00
drh
aa79e434f1 Merge all the enhancements and bug fixes from trunk, since none are
destablizing.  Call this the second beta.

FossilOrigin-Name: fb3ee1b7cac09e4950e4f48b44c277e4f391cb6c8f069644732d2389ca653da4
2017-10-21 17:17:17 +00:00
drh
6fe3733ba9 Catch and avoid a 16-bit integer overflow on the number of columns in a
common table expression.  This fixes a problem found by OSS-Fuzz.  The
test case is in TH3.

FossilOrigin-Name: 6ee8cb6ae5fd076ec226bb184b5690ba29f9df8cfaef47aaf13336873b4c1f6c
2017-10-21 14:17:31 +00:00
drh
316ab93e2c Remove unnecessary "#if SQLITE_MAX_COLUMN". SQLITE_MAX_COLUMN is always
defined.

FossilOrigin-Name: 6ec82acde81a46a75ed5931fc7dd813f2523753106ad7b8f0b544b9da9824d5a
2017-10-21 13:29:26 +00:00
dan
f2f72a0f9f Take extra care to avoid an OOB read caused by a corrupt b-tree page.
FossilOrigin-Name: 04925dee41a21ffca9a9f9df27d8165431668c42c2b33d08b077fdb28011170b
2017-10-19 15:17:38 +00:00
dan
c1abf2d360 Avoid using snprintf as a member variable of a struct in sqlite3ext.h. This
causes problems on OSX. Similar to fix [a1fd3aa8].

FossilOrigin-Name: cd0471ca9f75e7c8be74536ff4ec85b5d70f0d7994b680ed5f45b9f12a46cf46
2017-10-18 15:02:01 +00:00
dan
af124faf3e Avoid using snprintf as a member variable of a struct in sqlite3ext.h. This
causes problems on OSX.

FossilOrigin-Name: b066d5a69f5391b2cef04b4e288f7d33e63a4ff54325b7e9fbd6aa42529c2f3c
2017-10-18 14:29:36 +00:00
mistachkin
f7fc4c22f4 The source code files generated for the 'sqlite3-all.c' target should not have Windows line-endings.
FossilOrigin-Name: 6a08c43431be18a08bdcbf33d327513f72fff72dac5d02103dab8399d8c3d668
2017-10-17 18:33:22 +00:00
drh
f30d345241 Fix the ".check" command of the command-line shell to return 1 (error)
rather than 2 (exit) on a test failure.

FossilOrigin-Name: e2af0cc6ef5fafc785b8b73f51995901f50822972dcfb632494e22402596186d
2017-10-17 13:44:46 +00:00
drh
989d7278b0 Improved comments, including a typo fix, on the whereLoopCheaperProperSubset()
function.

FossilOrigin-Name: 700a3c694438ca6cca185d0097f24799e82717ef38cb47bd83666c80f0e3cb2f
2017-10-16 11:50:12 +00:00
drh
47b1d68f25 In the query planner, do not consider index X to be a proper subset of
index Y if X is a covering index but Y is not.

FossilOrigin-Name: ee31c04353cd75ea4bbadee2994c30d3808b696a4f680187502d104902988a5d
2017-10-15 22:16:25 +00:00
mistachkin
82cae9ffd6 Updates to the Makefiles for MSVC. Cherrypick of [ac8786f3f9f35cb6].
FossilOrigin-Name: 92eb721faefcdd8396072722d3e4d7ca41b860b306e4bb0f0191dde8f30d0add
2017-10-14 19:58:37 +00:00
mistachkin
835cd436e1 Updates to the Makefiles for MSVC.
FossilOrigin-Name: ac8786f3f9f35cb6fa72c65f5ca41cc6659f4702cd29ab0c9dcf04d3d1189090
2017-10-14 19:54:06 +00:00
drh
96a206fa10 Improved ability to generate stand-alone program using TCL and SQLite by
compiling with -DTCLSH_INIT_PROC=name to cause the TCL interpreter to be
initialized using procedure name().  Both sqlite3_analyzer and testfixture
are now built this way.

FossilOrigin-Name: d65d1f297ddb07b799ff5b2e560575fc59a6fa74c752269cc85ab84348fb7da4
2017-10-13 20:14:06 +00:00
drh
903b23022d Add the tcl/mkccode.tcl script used to construct a single C-language source
fiel for programs that combine C-code, SQLite, and TCL.  Use this script to
construct the sqlite3_analyzer program.

FossilOrigin-Name: 298a3fddec459c4fd2b840bd363239dc627f1dda90e2d5e478846cb895a8ad82
2017-10-13 18:58:55 +00:00
drh
f291dff22c Move a bunch of unrelated test code out of tclsqlite.c and into
test_*.c files.  There is still some test code in tclsqlite.c, but the amount
is greatly reduced.

FossilOrigin-Name: a9c4bc88fcf985a0bea14ed5381239cfb697886287998da04a10230b6858ab5d
2017-10-13 16:19:48 +00:00
drh
8544d43e4a The db_use_legacy_prepare command no longer exists. Use the undocumented
-use-legacy-prepare option to DB version instead.

FossilOrigin-Name: ea2fa9ab9b3c97e001c1a2f3e24f3554b544070d5f915b9827eb07eb5ea8f00b
2017-10-13 16:01:36 +00:00
drh
1df6470d35 When compiling with SQLITE_TEST, extra options are available on the
"DB version" command for controlling the internal state of the SqliteDb
object, for testing purposes.

FossilOrigin-Name: bf86478d9c6b899d6441e80cf9d17b58731e5d354e31b11f0d58a798f6fab896
2017-10-13 15:56:26 +00:00
drh
c318f730a4 Move some test logic out of tclsqlite.c and into auxiliary test_*.c files.
This is a work in progress.

FossilOrigin-Name: 95b7687fed75b32a62a0c62d397f4f543bf40095e13c22e15938d5dcfd71fcdf
2017-10-13 15:06:06 +00:00
drh
88dd668942 Add the sqlite_dbpage virtual table (enabled using SQLITE_ENABLE_DBPAGE_VTAB).
Make that virtual table and dbstat available to the command-line shell.

FossilOrigin-Name: eaeeb09d4aa1dbccdd2488af8461e2a8c8a53d92c63fd56330be041ad72a9e4a
2017-10-12 20:37:20 +00:00
drh
277ee81bab Create the new ext/repair folder and move checkfreelist.c there. Remove
checkfreelist.c from the command-line shell (undoing check-in [48418f2e]).

FossilOrigin-Name: dfdebd12bfc80b91d234ab328cb6106d5d37ccb79b58e36e556c1a8af640a4ab
2017-10-12 19:50:28 +00:00
drh
6235ee5784 Fix a harmless compiler warning about an unused parameter.
FossilOrigin-Name: de20133d44773f0b3b8869db5c1cb2a90f0426a54c7f40d12a930003343ad8e0
2017-10-12 14:18:38 +00:00
drh
0a38646806 Fix the "snapshot-tarball" makefile target, which was broken by the shell.c
change of check-in [36acc0a9].

FossilOrigin-Name: c643ace24c1936f9d2b16bd6d1d13cf08070dfe5b094208b638924e904915339
2017-10-12 14:13:20 +00:00
drh
81a2160bf9 Merge fixes from trunk. All changes are on makefiles and test scripts.
There are no core code changes.

FossilOrigin-Name: 1fb87a0c6e4db1f8bf51d552d9af1252544b7d7bd2dd80f78870f3b4fd347bad
2017-10-12 14:03:09 +00:00
drh
aa62d2e48f The src/shell.c file is now generated from src/shell.c.in, so remove shell.c
from version control and update the makefiles to build it automatically.

FossilOrigin-Name: 36acc0a97fdcc6f54f29c68c4e131702f69c3e59e58237ff4e5c647928699956
2017-10-12 13:47:48 +00:00
drh
ddba6c38df Merge fixes from the 3.21 branch.
FossilOrigin-Name: 292921692c8919d29f0a67d03ca953d5c1c4900d8c8567cceab27513732be598
2017-10-12 13:21:56 +00:00
dan
122ab8fd9d Fix a potential crash that may follow an OOM or other system error in the shell tool.
FossilOrigin-Name: c36761e1a05c15c48468dd793faf06636f5dcfd3b4314074c4d9c9eac5c2695c
2017-10-12 11:33:13 +00:00
dan
e1b972bd38 Update some test cases to work with SQLITE_OMIT_VIRTUALTABLE and
DEFAULT_AUTOVACUUM builds.

FossilOrigin-Name: 4b68f424ca9b5d4b0e77065a4e60ec0f70dcce0d01053fd7a6b2ecae9d3a5967
2017-10-12 11:13:34 +00:00
drh
4c6cddcaab Make sure the tableColumnList() routine of the command-line shell does not
cause a null-pointer dereference in an error condition.

FossilOrigin-Name: 5d0ceb8dcdef92cd72307e532a4a6c269b2c458fecb0bbede0bb941099eebc5b
2017-10-12 10:28:30 +00:00
drh
f02f8a7102 Merge fixes from the 3.21 branch.
FossilOrigin-Name: 18d4654fd161900f98ff435ea9e0a3c44b9972f84ee9f43096f9998f844ff857
2017-10-12 01:24:36 +00:00
drh
8a18100d44 Fix a typo in a numeric constant in an assert() - a bug that has been present
in the code since check-in [79e22b95038] on 2010-03-30.

FossilOrigin-Name: f0a2724f0a255cd5a262f31e4ee1f99ae713c25a9ecc56dc794c95f223453b9b
2017-10-12 01:19:06 +00:00
dan
3c48e6551b Add test file mmapwarm.test. With tests for the sqlite3_mmap_warm() extension.
FossilOrigin-Name: 5c4980ef17291dcea5e93ead353b9a95e2fbff56ff7257e9878d095f6827b4e9
2017-10-11 20:27:03 +00:00
drh
f294ce648b Add the checkfreelist extension to the command-line shell.
FossilOrigin-Name: 48418f2ed5ab1cb270776166141ce32ed3ebf22ed4e33a66a204d4fde9d11f52
2017-10-11 18:26:26 +00:00
dan
7d157f91f4 Check that the leaf count on each freelist trunk page is in range as part of
checkfreelist processing.

FossilOrigin-Name: 4e89406248f51d3b83d61e5472fb493f3d3b4ff2a69bf256c7e15445eeb2f3ec
2017-10-11 18:21:44 +00:00
dan
36187fe8c2 Add new extension "checkfreelist", which uses sqlite_dbpage to check that
there are no invalid entries on the database free-list.

FossilOrigin-Name: 21930ef5376261d95fa325be7761d327a350d4ae6b4573c83ddb4d294dea51c4
2017-10-11 18:00:34 +00:00
drh
512e6c3c51 Convert the implementation of the ".dbstat" dot-command of the command-line
shell to use the sqlite_dbpage table.

FossilOrigin-Name: 497409e167c7c025fbddc319b4fa9a8b965f70d05ac88c060dee469f70321388
2017-10-11 17:51:08 +00:00
mistachkin
690e8858fe Make JSON1 defines consistent in the makefiles for MSVC.
FossilOrigin-Name: 31eee0e4bffc5419e076a589049bfea7327dfc666fcc2767c0b700f506055c4e
2017-10-11 17:50:22 +00:00
drh
9b40ab45b2 Enable JSON by default in the Windows command-line shell sqlite3.exe.
FossilOrigin-Name: 79c96121baf065fd78ba4f1fe82ce725b6372df20e9323d88022b7c243701372
2017-10-11 17:25:08 +00:00
drh
ca5cf1229b Enable sqlite_dbpage and dbstat virtual tables in the shell, by default.
FossilOrigin-Name: 01bf856c424c20b464f26973720bf5dcd3e89509c5b02c3625d4828f0385d3db
2017-10-11 17:13:29 +00:00
drh
34d0b1ac56 Get writes working on the sqlite_dbpage virtual table. Add a few test cases.
FossilOrigin-Name: a8b264d811e5bcb7e3ae8a12bf5b6830a9d1adff1f59436dda9e886f97da242f
2017-10-11 15:02:53 +00:00
drh
a43c8c8a60 Initial implementation of the "sqlite_dbpage" virtual table. Currently
it is read-only and has a place-holder xBestIndex.

FossilOrigin-Name: c2c1d656e3f52465192c2a697a976cd1837ccc4e10708a2377cff8bf6eaa7d49
2017-10-11 13:48:11 +00:00
drh
ff0a67a1a7 In the speed-check.sh test script, allow an additional test-name argument
which becomes the comparison baseline, in place of "trunk".

FossilOrigin-Name: 0245adffc6f9b580217e0d2feb396d6895e54cdc25f5dfc9c8f4090b919e9e49
2017-10-11 12:20:36 +00:00
drh
679afb492e Create a branch for the 3.21.0 release. Development continues on trunk.
FossilOrigin-Name: 0f160a8abb0409b6e687ebc13b732559b3d65428f72430df142fd925eb39e9a2
2017-10-11 11:12:20 +00:00
drh
a2c41c2f2b DROP TABLE now works for WITHOUT ROWID tables and the SQLITE_OMIT_AUTOVACUUM
compile-time option.  Fix for ticket [e651b1341861d6]

FossilOrigin-Name: b8c1b5a584aeb6ab63cff875ca16135efeadac16b4b32afa589845477feebf32
2017-10-10 13:37:22 +00:00
mistachkin
94ea27f808 Fix harmless compiler warnings in FTS5 seen with MSVC.
FossilOrigin-Name: 5594a121bf132a98d0ecb4cf86d9f2681925c9416206096bf11c9370a5dae22f
2017-10-08 02:22:06 +00:00
mistachkin
cc24f81576 Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: 39d920d1ef0cce40195b21e148f78f544710348fa180c0e76f743a73e5236d45
2017-10-07 23:58:55 +00:00
mistachkin
4537f77a53 Revise variable declaration moved in the previous check-in so sqlite3VdbeReset() is consistent with sqlite3VdbeRewind().
FossilOrigin-Name: 63d1b425ee6a7d2ae782b738d81d98e39342ae7fe7c4fd217a28a0bdafe4f222
2017-10-07 23:35:40 +00:00
mistachkin
b60424e495 Fix C99-style variable declaration issue seen with older versions of MSVC.
FossilOrigin-Name: 14b181e862bd742555c51b87fab59d6f8f6602fe2c18dde3ef3b020779912419
2017-10-07 23:31:33 +00:00
dan
a0ac086f15 Add tests for the example fts3 "rank" function that appears in the
documentation.

FossilOrigin-Name: 702b137aa4f76543647e177beeb1ca2b3cd18c61021c78880e9aa8656f341d65
2017-10-06 18:00:36 +00:00
drh
2ed5737aca Fix compiler warnings that come up with SQLITE_OMIT_WAL.
FossilOrigin-Name: 8ca0fa8dfe6a66aea7fc63f15e6f704cb190aa0760a3fec2db5f6bad3861a135
2017-10-05 20:57:38 +00:00
dan
5f54e2b5d3 Fix a problem building with SQLITE_OMIT_WAL defined.
FossilOrigin-Name: 373b0ace480aa303bbf512ea8806a17f6186b16d6316a7b724499bf94b3974d4
2017-10-05 20:02:49 +00:00
drh
c3cbd678a1 Fix the command-line shell so that the ".schema --indent" command does a better
job of dealing with \r\n in the middle of a CREATE statement in the schema.

FossilOrigin-Name: 4258fb578a6e75590c7314fe511ca8dc6659e5f2d3a54d8f60ff705fe51ccc92
2017-10-05 19:12:10 +00:00
drh
5aa1e7cd30 Disable the delta checksum verification in RBU by default. Reenable it using
-DRBU_ENABLE_DELTA_CKSUM, if desired.

FossilOrigin-Name: d22c99b6ba997179ef3ccd341d9c36d5213d699305d15942d82587a0bfd16f9d
2017-10-05 11:29:37 +00:00
drh
c6aa38159b Updates to requirements marks.
FossilOrigin-Name: 40964a4ef7565ea0ddf452f48cb22373d068528e07d40eefc008f2231c969422
2017-10-04 18:26:44 +00:00
dan
7b7c956f09 Update the speedtest1 program so that it prints the output of "PRAGMA
compile_options" if the -stats option is specified.

FossilOrigin-Name: 7c69f8f1089c3e3843fbf7ec37a897c849a3df822a4ce3b4fcde586adf991a3f
2017-10-04 17:05:04 +00:00
mistachkin
3dfbe9b3fc Fix typos in session extension header comments. No changes to code.
FossilOrigin-Name: 182ec9d6f6c44938de0a2cd542e259d082deeeabc12a1815fff35e3ed1e524ef
2017-10-04 16:35:01 +00:00
drh
f3b2c7aa81 New test cases for ticket [b899b6042f97f5] derived from a bug report on
the mailing list from Wout Mertens.

FossilOrigin-Name: ef94ea061d2ec8ee0243e97dfcfc7a7c75dd22006e61a7195b780722bbc925db
2017-10-04 14:13:29 +00:00
dan
4c16760c37 Amend recent changes to busy.test to avoid failing with SQLITE_ENABLE_STAT4
builds.

FossilOrigin-Name: 9ff4944194c56b38843bc626dc51604db8e1ca8a0fd221e2d6f78c840d57c341
2017-10-04 12:08:35 +00:00
drh
7c58fea39f Turn restriction 20 on the query flattener into an assert since the situation
restricted can no longer occur because of the more aggressive use of
co-routines.

FossilOrigin-Name: 4464f40ccd7c5553f4d44120ca6dac4e9445f08f083f7dcb3bd66b4413d818e0
2017-10-04 12:06:31 +00:00
dan
61b513e9e3 Add tests to verify that the busy-handler is invoked correctly when processing "PRAGMA optimize" and ANALYZE commands.
FossilOrigin-Name: fb83c3d8df250cb701fbe775b48ab93f5674496f68c57e04f50668c43c2de328
2017-10-04 10:39:28 +00:00
drh
cdb2f60743 Remove a redundant restriction from the query flattener.
FossilOrigin-Name: 66629b2a0997ceedcfb38553f2200466b6c4e352ea00f8a0a7cb67a660c19523
2017-10-04 05:59:54 +00:00
drh
e76acc654f Fix a minor typo in the query flattener header comment. No code changes.
FossilOrigin-Name: d050dc605c24bcf60c0c47d13612ad53b871d3d4eff681c0c1b933acf53fb5ee
2017-10-04 02:30:45 +00:00
drh
0c4db03481 Simplify the computation of types on columns of a view.
FossilOrigin-Name: 772b0db1469c9e1c2728cf65dd070e29c624e75c3a5da72ee1297f15d758dd13
2017-10-03 19:53:12 +00:00
drh
997a4deb4e Do not enable SELECT tracing with -DSQLITE_DEBUG. Require the
-DSQLITE_ENABLE_SELECTTRACE compile-time option to enable SELECT tracing.

FossilOrigin-Name: f5c395834c2a776beba6fe172cc4a5e428ce30b9cb4259ef8e440f10455a41e9
2017-10-03 18:35:57 +00:00
drh
8906a4b802 Add some OK_IF_ALWAYS_TRUE() marks on optimization branches in select.c.
FossilOrigin-Name: 1dd828088d6981dfebf9f4d650dad8431bece4405650c61f90eb8d8f43289b52
2017-10-03 17:29:40 +00:00
drh
ce2c482e5a Remove an unused variable from sqlite3Insert() and fix harmless
compiler warnings associated with -DSQLITE_MUTATION_TEST.

FossilOrigin-Name: 7be760e907274131bcd4acfaff9e72c9c59a05e7d411db3d9afe690fe0d64b4b
2017-10-03 17:17:34 +00:00
drh
a78d757c36 Fix the sqlite3_column_decltype() interface to return the correct datatype
when the value comes through a CTE.

FossilOrigin-Name: 966438bd259ade3a2d4a6ec9587ce79c81a21b942248bffb389995b9132b53e3
2017-10-03 16:57:33 +00:00
drh
e2463398fd The simplification to sqlite3SelectExpand() in last night's
[3a4ffb21] check-in was not completely correct.  This adjustment is needed
for correct OOM handling in some configurations.

FossilOrigin-Name: c5ad5e1675f6cb5a54df21606dfec2198a7cf88acc529460ebe27bdab128a6e5
2017-10-03 14:24:24 +00:00
drh
cafc2f7b3e Do not compute column and row size estimates for the transient Table objects
associated with the result set of a SELECT statement, since those estimates
are never used for anything constructive.

FossilOrigin-Name: e4342fd401d4025eecc53ebfcd59f3150166a5f0bd6adb1b5820703bd4a1ec58
2017-10-03 03:01:09 +00:00
drh
878fcf9d4e Mark a single branch within sqlite3SelectExpand() as an optimization.
FossilOrigin-Name: 3a4ffb21d0ee2326c31b9ddc512d79d4ebf3a249a2840e88e99165978eec31fd
2017-10-02 23:50:08 +00:00
drh
b7651e6b60 Simplification to sqlite3SelectPrep() for improved testability.
FossilOrigin-Name: 5bf2ccb908dc6ebf7e063014b0a4bed7e3e9e0a555f78c6b4f6647adfb7209e4
2017-10-02 23:30:45 +00:00
drh
2f65b2f512 Add the OK_IF_ALWAYS_TRUE() and OK_IF_ALWAYS_FALSE() macros for marking
conditionals that improve performance but do not change the outcome.

FossilOrigin-Name: 6035c9b2728f47d338696978eb6fe5a7d6cb84bbea0792ef985c0986ac8f39dd
2017-10-02 21:29:51 +00:00
drh
3ee1416b68 Avoid using lookaside memory for persistent virtual table structures.
FossilOrigin-Name: d815f255dfbcd6d64326f7bc0ad3fe3c4ff08270ca75f8836ef2a919d5e57401
2017-10-02 13:20:43 +00:00
drh
3fc5394258 The query planner now always prefers to implement a FROM-clause subquery using
a co-routine rather than flattening the subquery into the outer query.

FossilOrigin-Name: c9104b59c7ed360291f7f6fc8caae938e9840c77620d598e4096f78183bf807a
2017-10-02 02:52:54 +00:00
drh
de6422a609 Improvements to a comment in lempar.c. No code changes.
FossilOrigin-Name: 8000d230171fe53599fc6a916666f60f88f789e6c9c6c2869514c02d837d6fc8
2017-10-02 02:32:12 +00:00
drh
67cc51a491 More details in the header comment of pushDownWhereTerms(). No changes to
code.

FossilOrigin-Name: 928486231ff7cc0df17a5aa23a080a1b8720e168db5227a7dbd34861283ba689
2017-09-30 11:47:06 +00:00
drh
24ae373ab1 Make sure the SQLITE_Stat34 optimization switch is always 0x800, a value
which is hard-coded in the TH3 test suite.

FossilOrigin-Name: 6aed4ea34c4163c682ad5bb2956fdf4f3a3ad048fefd3edab0fef6761c3783cc
2017-09-30 10:50:34 +00:00
drh
508e2d00f3 Fix unreachable conditionals and revise a testcase that was made obsolete by
the changes on this branch.

FossilOrigin-Name: 71f0adf7ca6824c3aba69104b9976dbb71b377474529e1a36220b4804293501e
2017-09-30 01:25:04 +00:00
drh
25c221eb1d Always render a subquery that is not part of a join as a co-routine.
FossilOrigin-Name: 6b1651d711eae6e7c65a191f02ca2439160bcd677099712289e76a0f8422fd37
2017-09-29 22:13:24 +00:00
drh
fd06385f21 Merge the query flattener comment improvements from trunk.
FossilOrigin-Name: f62cd4d940506c39db82e83ff3df8ab1856f1fb91ffda835ae2d727263ee9b0b
2017-09-29 16:08:46 +00:00
drh
d981e8289a Clean up the comments on the query flattener to more clearly and accurately
express the conditions under which the flattener is able to run.

FossilOrigin-Name: 0840f9f824c16212ce3fd6c859e501176eb0a58924ea1728a54d5bdfd0c25c86
2017-09-29 16:07:56 +00:00
drh
129c398d4b Merge changes from trunk.
FossilOrigin-Name: 06f432fb7c979f1bb7f01f5c90716ce5c0248f73f70b78a9870b9de5c9bf7ef4
2017-09-29 14:31:16 +00:00
drh
824d21aff3 Make sure the 6th parameter to the authorizer callback for view subqueries
has the correct view name.

FossilOrigin-Name: 2a45bbc9fd1c64f1c4c4dac38f063cd67480fcb6da24bf93fdefbfca66fd81ab
2017-09-29 12:44:52 +00:00
drh
23768298d2 Better names for subqueries in EXPLAIN comments.
FossilOrigin-Name: 04ef40a8fea88776e0d8b73d942922d45d0c038fbfac1a9a82b9322181b4ad92
2017-09-29 12:12:52 +00:00
drh
648fe49f96 Do not flatten subqueries that contain an ORDER BY or GROUP BY clause and
can be implemented using a co-routine.

FossilOrigin-Name: 042d655dd9002e8b89a798ad955b0285891aecf79f6978c5312e70ffe0609a46
2017-09-28 20:06:53 +00:00
drh
2e9d706252 Remove the (undocumented) query-planner control that prevents
a "SELECT ALL" subquery in FROM clause from being implemented as a co-routine.

FossilOrigin-Name: ff2f5a31a2ac67a2fdbb25793e8013cb0e062ab90bdcba2d52a62d6d4d8b6d18
2017-09-28 17:29:24 +00:00
drh
3d240d2119 Fix over-length source code lines in select.c. No logic changes.
FossilOrigin-Name: fd3267ef92384fcefaee7460a5ffbaf8ddcb6049eec36f72a7046a43e2871fbf
2017-09-28 16:56:55 +00:00
drh
4e6cec1ca0 Fix an issue introduced by check-in [4cd2a9672c59] (2017-03-03) that could
allow a negative value in the 3rd parameter to memmove() when
defragmentPage() is called on a btree page with a corrupted
freeblock list.  The corruption is now detected early and results in
an SQLITE_CORRUPT return before the memmove() is reached.

FossilOrigin-Name: 5b9ae693120fe4f7bc3b6270f35d773876f6cc8f5990e05cce0d255c54b36ae7
2017-09-28 13:47:35 +00:00
drh
70efa84da7 Add new routines to simplify dealing with collating sequences in expressions:
sqlite3ExprNNCollSeq() and sqlite3ExprCollSeqMatch().

FossilOrigin-Name: 490e488ea963fe725b16212822c8608f2b6abce688931b611446bc2cbfe6b87c
2017-09-28 01:58:23 +00:00
drh
db8e68b4cd Indexes on expressions with a COLLATE clause are able to satisfy an ORDER BY
with the same COLLATE clause.

FossilOrigin-Name: 0413001843dce7c63659d39b329ca14cdcd54f4407922f51b2fb7659572a733e
2017-09-28 01:09:42 +00:00
drh
488e619192 In two places, change the magic number -1 to its proper symbol XN_ROWID.
FossilOrigin-Name: 80277d2fc9b76fe41e345d00952da1528e69884f25911cf6e4f78b09ff778421
2017-09-28 00:01:36 +00:00
drh
9325c87c26 Disable tests for the LIKE optimization when ICU is enabled, since the
LIKE optimization only works for the built-in LIKE operator and ICU overrides
the built-in.

FossilOrigin-Name: f5ef2e1bcd2790f960c15947f87cda19bd6a6a384ad09b25f6d07d5244cfecbd
2017-09-27 16:51:00 +00:00
dan
b92d585c60 Add an extra snapshot related test case.
FossilOrigin-Name: 24a95e143785bb8e12198092d13c979ec2e116fa8b55d0bf482cb473a92294d8
2017-09-25 09:37:37 +00:00