]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
5 years agoCorner-case changes to the bytecode virtual table for testability and bytecode-function
drh [Sat, 2 May 2020 00:01:39 +0000 (00:01 +0000)] 
Corner-case changes to the bytecode virtual table for testability and
correctness.

FossilOrigin-Name: baa720e4a88f268ed95337daab5f434fd3263b00f09101cddc6424765bf3b722

5 years agoMerge recent enhancements from trunk.
drh [Fri, 1 May 2020 18:58:21 +0000 (18:58 +0000)] 
Merge recent enhancements from trunk.

FossilOrigin-Name: 96dfc71ea599702ef38b60952d03e95dce5a8c534cd943e076e9c76b00e61e65

5 years agoClarification to the sqlite3_uri() family of interfaces. Documentation
drh [Fri, 1 May 2020 13:45:12 +0000 (13:45 +0000)] 
Clarification to the sqlite3_uri() family of interfaces.  Documentation
enhancement only - no changes to code.

FossilOrigin-Name: 853703cd6d44d6dd48ef5eda6523e374b8ebdf7c338ddaad31c15a40a8b3fd9b

5 years agoUpdate documentation for sqlite3_close_v2() for clarity. No functional
drh [Fri, 1 May 2020 13:32:19 +0000 (13:32 +0000)] 
Update documentation for sqlite3_close_v2() for clarity.  No functional
changes.

FossilOrigin-Name: 80498b69ea489e8816c80a52c9e55a62699116fcbfdcbfd922ef23c2d9938871

5 years agoAdd the new SQLITE_IOERR_DATA result code and use it in cksumvfs.
drh [Fri, 1 May 2020 11:31:43 +0000 (11:31 +0000)] 
Add the new SQLITE_IOERR_DATA result code and use it in cksumvfs.
Also enhance cksumvfs to emit an sqlite3_log() message whenever it finds
an invalid checksum.

FossilOrigin-Name: a094e8bfdef10d9e5d97f5a9f7c15b0fc547358b83367762ba5c2dfd2c9d0117

5 years agoDo not allow page_size changes on an active cksumvfs database.
drh [Wed, 29 Apr 2020 01:09:46 +0000 (01:09 +0000)] 
Do not allow page_size changes on an active cksumvfs database.

FossilOrigin-Name: 2c17cdce26fd935e6d81ff828f4670291fc014013c93b2a1578506598345ee86

5 years agoFix incorrect error message when something goes wrong with the
drh [Tue, 28 Apr 2020 23:09:56 +0000 (23:09 +0000)] 
Fix incorrect error message when something goes wrong with the
sqlite3_dbpage() table-valued function in the .dbinfo command of the CLI.

FossilOrigin-Name: 0dcf002463f5931c3875d2038d2b97298f1800b1cdfa70485d6430ab758f3b25

5 years agoAdd the cksumvfs extension.
drh [Tue, 28 Apr 2020 20:47:40 +0000 (20:47 +0000)] 
Add the cksumvfs extension.

FossilOrigin-Name: 237c10f941cc6cb775693ae87513ff1b816f12b5e9c3d57b057421204d2d02cf

5 years agoUse AtomicStore() when setting the mem0.nearlyFull boolean to avoid
drh [Tue, 28 Apr 2020 14:01:31 +0000 (14:01 +0000)] 
Use AtomicStore() when setting the mem0.nearlyFull boolean to avoid
harmless TSAN warnings and to forestall doubts about threadsafety.

FossilOrigin-Name: ce980af65a9b528f112baa22a95020a98ac5340155a0b53b09c46f99aad9b12b

5 years agoUse an AtomicLoad() macro in sqlite3HeapNearlyFull().
drh [Tue, 28 Apr 2020 11:45:41 +0000 (11:45 +0000)] 
Use an AtomicLoad() macro in sqlite3HeapNearlyFull().

FossilOrigin-Name: 7556bc632e271d8a1e4fd836ce91e28213768ac09c90857b91171e9cd1009884

5 years agoYet another attempt to enhance sqlite3_load_extension() so that it works
drh [Sun, 26 Apr 2020 22:04:48 +0000 (22:04 +0000)] 
Yet another attempt to enhance sqlite3_load_extension() so that it works
with Window-style pathnames using a backslash separator character.

FossilOrigin-Name: b73d9a7d6f7fec0ffc9640902a849289c305f8651e891388c01255c4da7a6c4b

5 years agoFix an issue with check-in [bc3bf7c6681a96bc] when compiling on Windows.
drh [Sun, 26 Apr 2020 14:33:54 +0000 (14:33 +0000)] 
Fix an issue with check-in [bc3bf7c6681a96bc] when compiling on Windows.

FossilOrigin-Name: 57b16d8ca3d1ede3b411389256bec6686433aae716f47bca309ee7c8e5fe3128

5 years agoFix the sqlite3_load_extension() interface so that it tolerates backslashes
drh [Sat, 25 Apr 2020 21:05:51 +0000 (21:05 +0000)] 
Fix the sqlite3_load_extension() interface so that it tolerates backslashes
in place of forward-slashes in pathnames on Windows.

FossilOrigin-Name: bc3bf7c6681a96bc18a1ed02f0ccced4731d5dab45f60c347dd1841706e6b62a

5 years agoEnsure affinity is not discarded from a view column if the view appears on the rhs...
dan [Sat, 25 Apr 2020 15:01:53 +0000 (15:01 +0000)] 
Ensure affinity is not discarded from a view column if the view appears on the rhs of a LEFT JOIN. Fix for [45f4bf4e].

FossilOrigin-Name: ac31edd3eeafcef46164a4506bbc32c711bb7cd78378aeaa4c9bb12524ac5ea1

5 years agoThe new sqlite3_database_file_object() interface requires that the pager
drh [Fri, 24 Apr 2020 18:20:30 +0000 (18:20 +0000)] 
The new sqlite3_database_file_object() interface requires that the pager
never invoke xOpen with SQLITE_OPEN_MAIN_JOURNAL unless it is using
a pointer to the journal name found in the Pager structure itself.   Make
this the case when processing a master-journal.

FossilOrigin-Name: b4987a5ced0c0f2c606c040e0c1b8ee11175f40ae35a7446308a43e77b1f1db2

5 years agoNew test case for ticket [1dcb4d44964846ad].
drh [Fri, 24 Apr 2020 17:55:52 +0000 (17:55 +0000)] 
New test case for ticket [1dcb4d44964846ad].

FossilOrigin-Name: 9e9f1e96c9aac60fcbbcda6923e01e350ca4dd88acefb9d400979419ba4e1e4d

5 years agoFix an uninitialized variable in the newly enhanced ".output" command of
drh [Thu, 23 Apr 2020 20:45:46 +0000 (20:45 +0000)] 
Fix an uninitialized variable in the newly enhanced ".output" command of
the CLI.

FossilOrigin-Name: 65c6c26bb48d5347ce53bb3607de3a03a5a03946b232d35e46a20533f86750f8

5 years agoFix an off-by-one error in the "calculated" page count output from the
drh [Wed, 22 Apr 2020 13:49:25 +0000 (13:49 +0000)] 
Fix an off-by-one error in the "calculated" page count output from the
sqlite3_analyzer utility for databases that are more than 1GB in size.

FossilOrigin-Name: 8789368b91fb5b7477bdba3a953412fc3839b4894443b65186f7b8f79f6369c9

5 years agoFix an integer overflow in fts3 causing a usan error.
dan [Wed, 22 Apr 2020 11:11:17 +0000 (11:11 +0000)] 
Fix an integer overflow in fts3 causing a usan error.

FossilOrigin-Name: e256f85289a78e629acdf83e5bf1f8df2a0ffb3d559738eb9e49db6c228dc8c0

5 years agoClarify the comment on the sqlite3BtreeGetRequestedReserve() routine.
drh [Wed, 22 Apr 2020 00:50:21 +0000 (00:50 +0000)] 
Clarify the comment on the sqlite3BtreeGetRequestedReserve() routine.
No changes to code.

FossilOrigin-Name: 52a6acca6d5d376308d354c02f4d676d9375c34c3841d7b1941196ee8b4e2511

5 years agoAdd the sqlite3_database_file_object() interface.
drh [Tue, 21 Apr 2020 20:19:25 +0000 (20:19 +0000)] 
Add the sqlite3_database_file_object() interface.

FossilOrigin-Name: f534ebeaaf34f825550138f09f9a40221dfa7cd5c6537ef9f86dce5249025ec3

5 years agoAdd the sqlite3_database_file_object() interface to sqlite3ext.h. sqlite3_database_file_object
drh [Tue, 21 Apr 2020 19:27:08 +0000 (19:27 +0000)] 
Add the sqlite3_database_file_object() interface to sqlite3ext.h.

FossilOrigin-Name: 3cabe06b6e9433cbfb4bf7bd72a425f43b54f57d84a205adbaa6a1147bbe46bf

5 years agoExperimental API: sqlite3_database_file_object().
drh [Tue, 21 Apr 2020 01:06:35 +0000 (01:06 +0000)] 
Experimental API: sqlite3_database_file_object().

FossilOrigin-Name: ae697b152d22737169892411a0c4d908895ff5fb249cce9bdb1ba0bbe32806f0

5 years agoDo not use O_NOFOLLOW when opening a directory just to call fsync() on
drh [Mon, 20 Apr 2020 17:35:32 +0000 (17:35 +0000)] 
Do not use O_NOFOLLOW when opening a directory just to call fsync() on
that directory.

FossilOrigin-Name: 2fc80ef16ce5878311ab88a0c64631813572ffbb71f75363b4619c9667e0926b

5 years agoEnhance the ".filectrl" command in the CLI to support the --schema option.
drh [Mon, 20 Apr 2020 16:21:30 +0000 (16:21 +0000)] 
Enhance the ".filectrl" command in the CLI to support the --schema option.

FossilOrigin-Name: 698d40db58b76f4094687d46b5c6292702a62168054f9e6a70ee86650a6635f7

5 years agoThe SQLITE_TESTCTRL_RESERVE operator is removed. In its place is the
drh [Mon, 20 Apr 2020 15:18:43 +0000 (15:18 +0000)] 
The SQLITE_TESTCTRL_RESERVE operator is removed.  In its place is the
more generate SQLITE_FCNTL_RESERVE_BYTES which is an API and which can
operator on more than just the main schema.

FossilOrigin-Name: abc1aad74f7b6a1e72fb09936239f2224aa942d16296c6a3de0b8daef4bc8471

5 years agoRemove an obsolete comment. No changes to code.
drh [Mon, 20 Apr 2020 14:05:54 +0000 (14:05 +0000)] 
Remove an obsolete comment.  No changes to code.

FossilOrigin-Name: 4135cb024456288d9c85aef5fb572dbb591527dd33d9a60ca5946b712c269941

5 years agoAdd the --bom option to the ".excel", ".once", and ".output" commands
drh [Sat, 18 Apr 2020 14:12:00 +0000 (14:12 +0000)] 
Add the --bom option to the ".excel", ".once", and ".output" commands
of the CLI.  Also fix the "--all" option on ".help" so that it works with
two dashes in addition to just one.

FossilOrigin-Name: d5b0def96ba6d90f47bc96fab1ccf9c501d84885d086744035b16fd96f3e248c

5 years agoFix the ".excel" command and the ".open -x" and ".open -e" command so that
drh [Fri, 17 Apr 2020 23:46:54 +0000 (23:46 +0000)] 
Fix the ".excel" command and the ".open -x" and ".open -e" command so that
they work better when running from an in-memory database and on Windows
and when running from a script.

FossilOrigin-Name: 07752164c2bf00b6885808533bbdb2cefbf1bf281a887b0b4f6316649a6cb810

5 years agoMerge accidentally created fork.
dan [Thu, 16 Apr 2020 15:56:03 +0000 (15:56 +0000)] 
Merge accidentally created fork.

FossilOrigin-Name: cb772b7a8fb53694cb267e74c11f49d2b9fd6920821c4e232f90ec35739c8904

5 years agoImprove corruption detection in fts3 shadow tables earlier in order to prevent an...
dan [Thu, 16 Apr 2020 11:35:27 +0000 (11:35 +0000)] 
Improve corruption detection in fts3 shadow tables earlier in order to prevent an assert() from failing.

FossilOrigin-Name: a9ec8c8f80a59badabb0afdb4189f0fd2934f936530d4151de395b3a7e7c1f1f

5 years agoClarification of the byte-order determination for UTF16 inputs to routines
drh [Wed, 15 Apr 2020 17:39:39 +0000 (17:39 +0000)] 
Clarification of the byte-order determination for UTF16 inputs to routines
like sqlite3_bind_text16() and sqlite3_result_text16() and others that
accept UTF16 input strings.

FossilOrigin-Name: a42fdcf54bcbd72a301dad4a040346dc48e67cacab43479ec618f5c32108c55f

5 years agoBuild the UINT collating sequence extension into the CLI.
drh [Tue, 14 Apr 2020 15:53:58 +0000 (15:53 +0000)] 
Build the UINT collating sequence extension into the CLI.

FossilOrigin-Name: 2b8c6b035a276029850de02651712a5fd69f4dfee45083d24b9d1f998004829b

5 years agoAdd the UINT collating sequence extension. The implementation is copied out
drh [Tue, 14 Apr 2020 15:48:55 +0000 (15:48 +0000)] 
Add the UINT collating sequence extension.  The implementation is copied out
of the "natsort" branch.

FossilOrigin-Name: 6f46c6e3e3c471ca864d7596e0211ee90316b784c8fe22c7ae177c9d29731dc7

5 years agoWhen compiling the shell for WinRT, avoid using Win32 APIs that are unavailable.
mistachkin [Thu, 9 Apr 2020 15:31:22 +0000 (15:31 +0000)] 
When compiling the shell for WinRT, avoid using Win32 APIs that are unavailable.

FossilOrigin-Name: 85d3dc8c50d8dbb8eac1956e8976e861d3b671e03355ca9257060fa3dca51cc4

5 years agoMerge recent trunk enhancements into the bytecode-function branch.
drh [Thu, 9 Apr 2020 15:07:22 +0000 (15:07 +0000)] 
Merge recent trunk enhancements into the bytecode-function branch.

FossilOrigin-Name: 7e6576ec00fde277c5c7abac264f7ec7e531de00c4e112bf733a07fe703fadcc

5 years agoLimit LIKE/GLOB pattern length to 100 bytes (default is 50K) when running
drh [Tue, 7 Apr 2020 15:07:11 +0000 (15:07 +0000)] 
Limit LIKE/GLOB pattern length to 100 bytes (default is 50K) when running
dbsql cases in the fuzzcheck utility.

FossilOrigin-Name: 10306118e8591e727af477a1a15d136852d21170e645bd0e75f7c88346b037d7

5 years agoAdd the --spinner option to the fuzzcheck test program.
drh [Tue, 7 Apr 2020 13:08:56 +0000 (13:08 +0000)] 
Add the --spinner option to the fuzzcheck test program.

FossilOrigin-Name: b1eae2686f03a6e20a49ca2b3a654b3019506d4941708ee3919c339cd093a57d

5 years agoThe ALTER TABLE fix of check-in [7e5ad8e0ab7ee91a] is no longer needed due
drh [Tue, 7 Apr 2020 01:18:23 +0000 (01:18 +0000)] 
The ALTER TABLE fix of check-in [7e5ad8e0ab7ee91a] is no longer needed due
to the changes at check-in [4cf8721f5ceb1fda].  But, we keep the defense
in place as an assert() for extra safety.

FossilOrigin-Name: 230556e859536bbadf0daf8133a9a01ef4f03148b3296723e37bad66e3fc3d82

5 years agoRemove dead code that was added during initial development of RENAME COLUMN
drh [Tue, 7 Apr 2020 00:54:09 +0000 (00:54 +0000)] 
Remove dead code that was added during initial development of RENAME COLUMN
but never actually served a purpose.

FossilOrigin-Name: c95c4cda4640f05d61b13b4e60494dec07d4483734fc41ffcce73fb5163cbb0d

5 years agoPerformance improvement in sqlite3ResolveExprNameList().
drh [Mon, 6 Apr 2020 20:35:52 +0000 (20:35 +0000)] 
Performance improvement in sqlite3ResolveExprNameList().

FossilOrigin-Name: 7e170e67f24c7cdef7e7ceac4e0b81a75382618e4abe9e604f3d7f6db9dc6396

5 years agoPerformance improvement for column name lookup.
drh [Mon, 6 Apr 2020 18:16:31 +0000 (18:16 +0000)] 
Performance improvement for column name lookup.

FossilOrigin-Name: 1e4b6a93987cdfbf829e2ff35ef417c290625f2894ad11949e301af518f1fb44

5 years agoWhen running ALTER TABLE, avoid adding some internally generated tokens to the token...
dan [Mon, 6 Apr 2020 16:37:05 +0000 (16:37 +0000)] 
When running ALTER TABLE, avoid adding some internally generated tokens to the token map to improve performance on schemas with nested views.

FossilOrigin-Name: 4cf8721f5ceb1fdaefdc355b3211f75c53c4cdf9d2582ca70fc96777a9b057c2

5 years agoRemove a NEVER() that could be true in sqlite3MatchEName().
drh [Sat, 4 Apr 2020 11:58:22 +0000 (11:58 +0000)] 
Remove a NEVER() that could be true in sqlite3MatchEName().

FossilOrigin-Name: 921448f0e24a3753374b32be9d7bf36a9ca5d8522eff9f0b51dc243f08652419

5 years agoIn the push-down optimization, do not substitute columns that have previously
drh [Sat, 4 Apr 2020 00:15:54 +0000 (00:15 +0000)] 
In the push-down optimization, do not substitute columns that have previously
been identified as being constant by the propagate-constants optimization.
Fix for ticket [51166be0159fd2ce]

FossilOrigin-Name: 70c44811d12f540d4ec1c29dedbe999cf79b82e326a8712ae2fa0725d6bd8a65

5 years agoAvoid factoring out constant expressions on the LHS of an IN(...) operator, as the...
dan [Fri, 3 Apr 2020 19:37:14 +0000 (19:37 +0000)] 
Avoid factoring out constant expressions on the LHS of an IN(...) operator, as the IN(...) operation may affect the affinity of these values.

FossilOrigin-Name: 98d56b4a34fddcbaecd953a045ae0270b4d78c1edf34cc73522fb4e12743af80

5 years agoAdd a test case to fuzzdata8.db for the recent Henry Liu bugs.
drh [Fri, 3 Apr 2020 16:11:32 +0000 (16:11 +0000)] 
Add a test case to fuzzdata8.db for the recent Henry Liu bugs.

FossilOrigin-Name: 42b02454b146ca1b04c0a5321465326435fc5b995f5498d3b1cf69c558a20f95

5 years agoMerge updates from trunk.
drh [Fri, 3 Apr 2020 15:48:05 +0000 (15:48 +0000)] 
Merge updates from trunk.

FossilOrigin-Name: 348c40136c8ec20f36ccdd4c8a6d4ec2d8274328b86b25b385813e3aae31ea8b

5 years agoIn the event of a semantic error in an aggregate query, early-out the
drh [Fri, 3 Apr 2020 13:19:03 +0000 (13:19 +0000)] 
In the event of a semantic error in an aggregate query, early-out the
resetAccumulator() function to prevent problems due to incomplete or
incorrect initialization of the AggInfo object.
Fix for ticket [af4556bb5c285c08].

FossilOrigin-Name: 4a302b42c7bf5e11ddb5522ca999f74aba397d3a7eb91b1844bb02852f772441

5 years agoDo not suppress errors when resolving references in an ORDER BY clause belonging...
dan [Fri, 3 Apr 2020 11:52:59 +0000 (11:52 +0000)] 
Do not suppress errors when resolving references in an ORDER BY clause belonging to a compound SELECT within a view or trigger within ALTER TABLE. Fix for ticket [a10a14e9b4ba2].

FossilOrigin-Name: 684293882c302600e112cf52553c19d84fdb31663d96e5dd7f8ac17dda00a026

5 years agoFix a case when a pointer might be used after being freed in the ALTER TABLE code...
dan [Fri, 3 Apr 2020 11:20:40 +0000 (11:20 +0000)] 
Fix a case when a pointer might be used after being freed in the ALTER TABLE code. Fix for [4722bdab08cb1].

FossilOrigin-Name: d09f8c3621d5f7f8c6d99d7d82bcaa8421855b3f470bea2b26c858106382b906

5 years agoFix a minor problem with EXPLAIN QUERY PLAN for triggers.
drh [Thu, 2 Apr 2020 19:58:31 +0000 (19:58 +0000)] 
Fix a minor problem with EXPLAIN QUERY PLAN for triggers.

FossilOrigin-Name: 6e11c03f84efa93b218b07e39b6b56b1d872639f39c18498ee54d8cd8364d4f5

5 years agoMinor changes for better test coverage.
drh [Thu, 2 Apr 2020 17:21:51 +0000 (17:21 +0000)] 
Minor changes for better test coverage.

FossilOrigin-Name: ae3ac297d2deee2a687ae2e9cf98aaf3e1b41196363238101a19d38092aebec6

5 years agoFix an obsolete comment in the parameter binding logic of the CLI.
drh [Thu, 2 Apr 2020 13:21:10 +0000 (13:21 +0000)] 
Fix an obsolete comment in the parameter binding logic of the CLI.
No changes to code.

FossilOrigin-Name: c9c735e201d7900d8c2b766463a6c90f547d9844352719dc650734e25e635fad

5 years agoFix another harmless compiler warning.
drh [Thu, 2 Apr 2020 13:08:54 +0000 (13:08 +0000)] 
Fix another harmless compiler warning.

FossilOrigin-Name: 949eec2530bbe7f48daddfb3022d60ea5d7a43f0f5d120e71c682054feb721db

5 years agoAdd a missing #ifdef to avoid a harmless compiler warning.
drh [Thu, 2 Apr 2020 12:53:17 +0000 (12:53 +0000)] 
Add a missing #ifdef to avoid a harmless compiler warning.

FossilOrigin-Name: cc54de354317ebc080d4d1ee25427b31a49c4a75e01cb5d9966f1aaeb2ad098d

5 years agoMerge enhancements from trunk.
drh [Thu, 2 Apr 2020 12:24:08 +0000 (12:24 +0000)] 
Merge enhancements from trunk.

FossilOrigin-Name: d1731385c077f298b0cf654d6183ed40f7e5c07e4e2ab7f69109cf951ce99d9e

5 years agoUse __atomic_load_n() and __atomic_store_n() for a few more things where they are...
dan [Mon, 30 Mar 2020 13:35:05 +0000 (13:35 +0000)] 
Use __atomic_load_n() and __atomic_store_n() for a few more things where they are available.

FossilOrigin-Name: a49f8ec552bede7da731e0571ccf49de1a30e7be3a5673150436c8b411ba6ffc

5 years agoFix "GCC_VESRION" typo in wal.c.
dan [Mon, 30 Mar 2020 11:17:37 +0000 (11:17 +0000)] 
Fix "GCC_VESRION" typo in wal.c.

FossilOrigin-Name: fbd9378727141848ba2f5a8eee3076ecbd315e4a87b264c6d890103d56b2e4bc

5 years agoEnhancements to the SQLITE_ENABLE_SETLK_TIMEOUT compile-time option to avoid
drh [Sat, 28 Mar 2020 19:02:39 +0000 (19:02 +0000)] 
Enhancements to the SQLITE_ENABLE_SETLK_TIMEOUT compile-time option to avoid
rare deadlocks on recovery.

FossilOrigin-Name: 06885e9aa4e430d10f4b32105bcf405c65fd6f7b4cd451baf56fb4f12f408963

5 years agoMSVC does not allow constant expressions as initializers for
drh [Sat, 28 Mar 2020 12:01:25 +0000 (12:01 +0000)] 
MSVC does not allow constant expressions as initializers for
constants with /fp:strict.

FossilOrigin-Name: 076658e5d21d9284448f41312b83a6c3d25394c2bfa088ef6cdfe1dc60277856

5 years agoModifications to the way blocking locks are used in SQLITE_ENABLE_SETLK_TIMEOUT build... setlk-deadlock-fix
dan [Fri, 27 Mar 2020 17:23:17 +0000 (17:23 +0000)] 
Modifications to the way blocking locks are used in SQLITE_ENABLE_SETLK_TIMEOUT builds so that multiple processes or threads may not deadlock when operating on a single database.

FossilOrigin-Name: c516027d5fd876b7d0bf566435667d554db29ded30ad6fc1165caa4a93d015a0

5 years agoAdd the tables_used() table-valued function as a variation on bytecode().
drh [Thu, 26 Mar 2020 16:48:18 +0000 (16:48 +0000)] 
Add the tables_used() table-valued function as a variation on bytecode().

FossilOrigin-Name: 6283c677d57220e54375a6463f453c6d068e042263558df16cff1055d1b0d3f5

5 years agoMerge updates from trunk.
drh [Thu, 26 Mar 2020 15:28:46 +0000 (15:28 +0000)] 
Merge updates from trunk.

FossilOrigin-Name: d7db09101878102e192ee7a81437e8f6f2e317ddf110852673a2e81d1f80ae0e

5 years agoReinstate the optimization that converts "x IN (y)" into "x==y".
drh [Thu, 26 Mar 2020 00:29:50 +0000 (00:29 +0000)] 
Reinstate the optimization that converts "x IN (y)" into "x==y".

FossilOrigin-Name: 27936e6884e77093533719c7955a17f051cfb359872e51a6d1481152e6256443

5 years agoFor the LIKE pattern in the .dump command of the CLI, accept backslash as
drh [Wed, 25 Mar 2020 20:31:45 +0000 (20:31 +0000)] 
For the LIKE pattern in the .dump command of the CLI, accept backslash as
an escape character.

FossilOrigin-Name: 029ceea612f5c7a1420939d8a772eefcc6f9550d24d57b52ae1729ea9d85fae9

5 years agoEnhance the ".dump" command in the CLI so that it accepts multiple LIKE
drh [Wed, 25 Mar 2020 12:50:13 +0000 (12:50 +0000)] 
Enhance the ".dump" command in the CLI so that it accepts multiple LIKE
pattern arguments and shows the union of all matching tables.

FossilOrigin-Name: 45fba3d7055f90f67005ca740687f060a2311db40c8f6a161bfea0424e6ebf6d

5 years agoOptimize the "subprog IS NULL" constraint.
drh [Tue, 24 Mar 2020 18:41:58 +0000 (18:41 +0000)] 
Optimize the "subprog IS NULL" constraint.

FossilOrigin-Name: ca8c5f028b9f6f32639c8bc9df5dc02537e21385fcbe7e1ae600c640977ea0d5

5 years agoFix a memory leak.
drh [Tue, 24 Mar 2020 17:52:31 +0000 (17:52 +0000)] 
Fix a memory leak.

FossilOrigin-Name: c9f3405eeac8aff171b5d76bae954f3b51b353d16286a3d2af43ef942c212abc

5 years agoProvide content for the bytecode.subprog column.
drh [Tue, 24 Mar 2020 13:27:53 +0000 (13:27 +0000)] 
Provide content for the bytecode.subprog column.

FossilOrigin-Name: df893364b7cea07ff2b15b80cb294dccaffe701d51452264599b55304a36fa7c

5 years agoFix the build so that it works even without SQLITE_ENABLE_EXPLAIN_COMMENTS.
drh [Mon, 23 Mar 2020 23:17:38 +0000 (23:17 +0000)] 
Fix the build so that it works even without SQLITE_ENABLE_EXPLAIN_COMMENTS.

FossilOrigin-Name: 5896cbf4d0c7854c29c96d2ea2cea4adaedaa027a0fe4a3f0ac4dfbeaabb8dec

5 years agoThe bytecode() function now runs and sometimes works, but it untested and
drh [Mon, 23 Mar 2020 20:58:55 +0000 (20:58 +0000)] 
The bytecode() function now runs and sometimes works, but it untested and
there are known problems.

FossilOrigin-Name: 6819b86eb2de516c445655a83f9b2ba5ae0bff660cffaf84f1345d9be79b051e

5 years agoFurther simplification and modularization of the EXPLAIN logic.
drh [Mon, 23 Mar 2020 19:14:11 +0000 (19:14 +0000)] 
Further simplification and modularization of the EXPLAIN logic.

FossilOrigin-Name: aee1c12f4227cea9e8c6295cee3ec11797422c31b48c9468f176eb52f8261fe8

5 years agoBegin breaking appear the sqlite3VdbeList() routine into subroutines that
drh [Mon, 23 Mar 2020 17:24:46 +0000 (17:24 +0000)] 
Begin breaking appear the sqlite3VdbeList() routine into subroutines that
can be reused by the bytecode() table.

FossilOrigin-Name: 2c4dd79fbd4b9f72634a732abb9ed833cd8c9b05fe1e10af8f23e6d6ec023c7c

5 years agoInfrastructure for the bytecode() table-valued function. The function itself
drh [Mon, 23 Mar 2020 15:49:22 +0000 (15:49 +0000)] 
Infrastructure for the bytecode() table-valued function.  The function itself
is not yet implemented.

FossilOrigin-Name: 2795f0d633577e0de66b389d9e8e44c55e85975bdc62f1a0b8f93959d19b22bf

5 years agoFix to the recomputation of the colUsed field added by check-in
drh [Sat, 21 Mar 2020 23:10:38 +0000 (23:10 +0000)] 
Fix to the recomputation of the colUsed field added by check-in
[a9bb71ba708ba722].  This fixes ticket [5829597ac43811e3].

FossilOrigin-Name: 5d14a1c4f2fc17de98ad685ad1422cdfda89dfccb00afcaf32ee416b6f84f525

5 years agoEnhance the treeview system to show the SrcList_item.colUsed field for
drh [Sat, 21 Mar 2020 22:03:32 +0000 (22:03 +0000)] 
Enhance the treeview system to show the SrcList_item.colUsed field for
FROM clause elements.

FossilOrigin-Name: 8a5c539b77aa174c048a504d211c56902075f9b42b654e1f8cc5767739e5fcc9

5 years agoSimplify some of the code modified by the previous commit.
dan [Sat, 21 Mar 2020 20:58:05 +0000 (20:58 +0000)] 
Simplify some of the code modified by the previous commit.

FossilOrigin-Name: 04abadb545d1b34bdd74d62becb3bfd83aceee373fd6b4b708d5ad53f41d9464

5 years agoEnsure that "main" can always be used to refer to the main database, even if it has...
dan [Sat, 21 Mar 2020 15:41:55 +0000 (15:41 +0000)] 
Ensure that "main" can always be used to refer to the main database, even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME.

FossilOrigin-Name: 682b426f5658254e63dff02c960b557fb33cb3e944fdd14faa0aa9988af7269a

5 years agoConsolidate some code on this branch. main-alias-fix
dan [Sat, 21 Mar 2020 15:10:40 +0000 (15:10 +0000)] 
Consolidate some code on this branch.

FossilOrigin-Name: a85c63daa640e02fdfd891a05a1a09e848c9621a5dd6e112338451008623ecbb

5 years agoChange a bitfield in sqlite3_stmt into an unsigned character, for slightly
drh [Sat, 21 Mar 2020 15:07:27 +0000 (15:07 +0000)] 
Change a bitfield in sqlite3_stmt into an unsigned character, for slightly
smaller code and better performance.

FossilOrigin-Name: 0d4d3c642494ad494b4ec937215eaf833158e62e5ae59ed981d6b546220c13b8

5 years agoPerformance optimization in sqlite3VdbeMakeReady().
drh [Sat, 21 Mar 2020 14:22:27 +0000 (14:22 +0000)] 
Performance optimization in sqlite3VdbeMakeReady().

FossilOrigin-Name: aa92f9b95f95d40cc58910da87168a5bd440f71deb072dc651bb15936315786c

5 years agoRecompute the set of columns used for each table when the table is
drh [Sat, 21 Mar 2020 00:05:53 +0000 (00:05 +0000)] 
Recompute the set of columns used for each table when the table is
involved in query flattening.

FossilOrigin-Name: a9bb71ba708ba72255ba8d18c9856e38ddf53eae2d61c8435149354fb2b2459e

5 years agoAllow "main" to be used to refer to the main database even after SQLITE_DBCONFIG_MAIN...
dan [Fri, 20 Mar 2020 20:54:28 +0000 (20:54 +0000)] 
Allow "main" to be used to refer to the main database even after SQLITE_DBCONFIG_MAINDBNAME has been used to assign another alias.

FossilOrigin-Name: 75c85ca32f9ae4a28fd8f8ff2f7639599413d22af706e9799a0e76cc560d14eb

5 years agoAvoid an undefined integer overflow in fts3 by detecting data structure corruption...
dan [Fri, 20 Mar 2020 20:18:49 +0000 (20:18 +0000)] 
Avoid an undefined integer overflow in fts3 by detecting data structure corruption earlier.

FossilOrigin-Name: 86e98ddc19470410ccc6d2cf4ad56ef0bc5a23b7fbe6331b8cae374689f54529

5 years agoChagnes the ESCAPE clause on the LIKE operator to overwrite wildcard
drh [Thu, 19 Mar 2020 18:13:28 +0000 (18:13 +0000)] 
Chagnes the ESCAPE clause on the LIKE operator to overwrite wildcard
characters, in order ot match the behavior of PosgreSQL.

FossilOrigin-Name: 11e0844f71e8f2d27ce9363fb505e02fd7795c61dae0b3886cf0d8df4484dd97

5 years agoFix an integer overflow problem with the dbstat virtual table that comes up
drh [Thu, 19 Mar 2020 17:27:52 +0000 (17:27 +0000)] 
Fix an integer overflow problem with the dbstat virtual table that comes up
when trying to analyze a corrupt database.

FossilOrigin-Name: 1d64f4a8af81fe1235fffa54884d8f842a48ff6a33d6172f0cd65bf42fe8b2a1

5 years agoFix a typo in a comment. No changes to code.
drh [Thu, 19 Mar 2020 15:57:03 +0000 (15:57 +0000)] 
Fix a typo in a comment.  No changes to code.

FossilOrigin-Name: 3a51919ac23ae7312d78905334dc97742b517a7476052a85aa07945d9c77697b

5 years agoFix handling of window functions in aggregate queries that have no GROUP BY clause...
dan [Mon, 16 Mar 2020 18:52:53 +0000 (18:52 +0000)] 
Fix handling of window functions in aggregate queries that have no GROUP BY clause. Also remove a faulty assert causing the error reported in [618156e3].

FossilOrigin-Name: 38e3dd389d142e520c71139ec84aa3c7722992af28a5f93a7f16e0ea176b74bb

5 years agoAt the end of the right-hand table loop of a LEFT JOIN that uses an IN
drh [Mon, 16 Mar 2020 03:07:53 +0000 (03:07 +0000)] 
At the end of the right-hand table loop of a LEFT JOIN that uses an IN
operator in the ON clause, put the OP_IfNoHope operator after the
OP_IfNotOpen operator, not before, to avoid a (harmless) uninitialized
register reference.  Ticket [82b588d342d515d1]

FossilOrigin-Name: 8b437b47266ec2d80d85eafcfdd6949556d6c28d9d67d5f43d89799f0f5b7bd0

5 years agoRemove stray comment characters at the end of an #ifdef that were
drh [Thu, 12 Mar 2020 17:54:39 +0000 (17:54 +0000)] 
Remove stray comment characters at the end of an #ifdef that were
accidently left in the previous check-in.

FossilOrigin-Name: ea914bec81c49625072fc9d23faa048300f3a0421e069d303b7203edcdfb3743

5 years agoFix comments and strengthen assert() statements associated with the
drh [Thu, 12 Mar 2020 17:28:27 +0000 (17:28 +0000)] 
Fix comments and strengthen assert() statements associated with the
OPFLAG_SEEKEQ and BTREE_SEEK_EQ flags.

FossilOrigin-Name: 231749213854756b599b33413b17b35186f17889b0c73f109fa9db726b415558

5 years agoDo not factor out constant functions into the initialization section of a
drh [Wed, 11 Mar 2020 19:56:26 +0000 (19:56 +0000)] 
Do not factor out constant functions into the initialization section of a
prepared statement, because even though they are constant, they can still
throw exceptions.  Instead, put such functions in an OP_Once block.  This
fixes ticket [3c9eadd2a6ba0aa5] and causes COALESCE() and CASE...END to
be short-circuit.

FossilOrigin-Name: c5f96a085db9688a09793f52ce1ecf033c2e6e2e5873a19fe0fb374b242b317f

5 years agoRename sqlite3ExprCodeAtInit() to sqlite3ExprCodeRunJustOnce(). do-not-factor-functions
drh [Wed, 11 Mar 2020 19:41:49 +0000 (19:41 +0000)] 
Rename sqlite3ExprCodeAtInit() to sqlite3ExprCodeRunJustOnce().
Other changes to make the new code cleaner.  Test cases added.

FossilOrigin-Name: d7f18489978fdbbe3ab317485518cac91a75416ccef55898301afdd76d3b415b

5 years agoDo not factor out constant functions into the initialization section at the
drh [Wed, 11 Mar 2020 17:58:27 +0000 (17:58 +0000)] 
Do not factor out constant functions into the initialization section at the
end of the prepared statement, be cause if they throw an exception, it will
abort the statement even if the function is never called.  Better to put
constant functions in an OP_Once block.

FossilOrigin-Name: 97a18a5cd701848a9660385e31bffe2c397e3cfe57ccdb876f44d08c00d1d39a

5 years agoThis variant to the fix for ticket [e0c2ad1aa8a9c691] uses fewer CPU cycles.
drh [Wed, 11 Mar 2020 02:04:15 +0000 (02:04 +0000)] 
This variant to the fix for ticket [e0c2ad1aa8a9c691] uses fewer CPU cycles.

FossilOrigin-Name: fb5a8a9edd0a4f979d6c30278d4ddc73c651f56ae989b4e5983fca36887c5ceb

5 years agoEnhanced detection logic for preventing the use of static schema expressions
drh [Tue, 10 Mar 2020 19:24:38 +0000 (19:24 +0000)] 
Enhanced detection logic for preventing the use of static schema expressions
by code generating routines.

FossilOrigin-Name: 5f60b527b938c0778e8f725c635ce0dc5ed7a4e01fd6252aa2cdb64da2f625bc

5 years agoFurther changes to ensure that expressions held in table and index definitions
drh [Tue, 10 Mar 2020 18:55:41 +0000 (18:55 +0000)] 
Further changes to ensure that expressions held in table and index definitions
do not get passed down into code generator logic where they might be modified.

FossilOrigin-Name: f45f5de000834da5b23cdcf12c3f0e3073287756afe06bdb77b95fb65b250258

5 years agoMake a copy of the expression that defines a value of a generated column
drh [Tue, 10 Mar 2020 13:35:04 +0000 (13:35 +0000)] 
Make a copy of the expression that defines a value of a generated column
before sending it to the code generator routines.

FossilOrigin-Name: 03d201c041c17579e791c73fe6babd60b9f892a84ffd1470851f8eb2857d3990

5 years agoApply the correct affinity transformations when pulling values off of the
drh [Tue, 10 Mar 2020 11:50:43 +0000 (11:50 +0000)] 
Apply the correct affinity transformations when pulling values off of the
sorter index used for GROUP BY.  Ticket [e0c2ad1aa8a9c691]

FossilOrigin-Name: 101f7dea75a203f1f3aa422a607ef701eb0901ba4d5e8d1075cd350454a61956