]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
5 years agoMinor fix for test file indexexpr1.test.
dan [Thu, 26 Sep 2019 19:53:26 +0000 (19:53 +0000)] 
Minor fix for test file indexexpr1.test.

FossilOrigin-Name: 0ceab26f15c4c7039647cbccf8939dd5c36a60b70ffeefcd3b415c8d4d8351cd

5 years agoNew dbsqlfuzz cases added to test/fuzzdata8.db.
drh [Thu, 26 Sep 2019 16:57:42 +0000 (16:57 +0000)] 
New dbsqlfuzz cases added to test/fuzzdata8.db.

FossilOrigin-Name: 49073b7003330027303c4c776e9f85112f8b99b89f848fec3f953eba501d7505

5 years agoTest for an OOM condition in resolveAlias().
drh [Thu, 26 Sep 2019 16:08:35 +0000 (16:08 +0000)] 
Test for an OOM condition in resolveAlias().

FossilOrigin-Name: 322eca7f6ad2234059669015aabb773a790e8bc3da95431c9c851ff5342c969b

5 years agoFix a window-functions problem that could occur if an ORDER BY clause contains an...
dan [Thu, 26 Sep 2019 15:53:37 +0000 (15:53 +0000)] 
Fix a window-functions problem that could occur if an ORDER BY clause contains an alias for a window-function that is not a top-level expression.

FossilOrigin-Name: 1cc6cf6407c6e25aeafeca379a93d0ad2614839c07fb3644e46926fce5f1cfab

5 years agoAdd a missing VdbeCoverage() macro.
drh [Wed, 25 Sep 2019 18:44:49 +0000 (18:44 +0000)] 
Add a missing VdbeCoverage() macro.

FossilOrigin-Name: 36d35dbd5a80dc4a149ed7409cc4b43712622fc4c6a8915b4fbb62fd1d6b7763

5 years agoRemove an unused variable.
drh [Wed, 25 Sep 2019 17:47:41 +0000 (17:47 +0000)] 
Remove an unused variable.

FossilOrigin-Name: a19884455b9bafcdc769362d61cfd02df1b5643263e004cb533698bbcfca752b

5 years agoFurther simplifications to window-function code.
dan [Wed, 25 Sep 2019 16:41:44 +0000 (16:41 +0000)] 
Further simplifications to window-function code.

FossilOrigin-Name: 5fe15c1d8383989257e11d1806e6b035acacd1b504ae385ba58d20db10f26eee

5 years agoIn the previous check-in, the variable should be openMode, not openFlags.
drh [Wed, 25 Sep 2019 11:49:36 +0000 (11:49 +0000)] 
In the previous check-in, the variable should be openMode, not openFlags.

FossilOrigin-Name: 77b0db22d6c7a031f332bfcf1c8fcd94e464de9f2396f0327ee761a30ebc8b60

5 years agoIn the unix VFS layer, do not attempt to chown() the journal to be the same
drh [Wed, 25 Sep 2019 10:36:31 +0000 (10:36 +0000)] 
In the unix VFS layer, do not attempt to chown() the journal to be the same
as the database if running in 8+3 filename mode.  Also, update the comments
on the chown() attempt to be more precise.

FossilOrigin-Name: ab853724a7e01ca32167d294c3c80d6632e805bdf39b6d56db82226a00ad72dc

5 years agoSimplifications to the window-function code.
drh [Wed, 25 Sep 2019 02:07:50 +0000 (02:07 +0000)] 
Simplifications to the window-function code.

FossilOrigin-Name: 489a1eb3aa2f1225b97b50a5f8688cf1a4ab0371973da1badc29616d70386c03

5 years agoBug fixes for window frames of the form (... RANGE BETWEEN b PRECEDING AND a PRECEDIN...
dan [Tue, 24 Sep 2019 20:20:05 +0000 (20:20 +0000)] 
Bug fixes for window frames of the form (... RANGE BETWEEN b PRECEDING AND a PRECEDING) or (... RANGE a FOLLOWING AND b FOLLOWING) where (a > b).

FossilOrigin-Name: 040e196a8be3ca41b9365310ab88c2a3cc84b918a6511c77a6d95d4b4e0da3ed

5 years agoOmit the sqlite3IntTokens array constant for a code simplification.
drh [Mon, 23 Sep 2019 12:38:10 +0000 (12:38 +0000)] 
Omit the sqlite3IntTokens array constant for a code simplification.

FossilOrigin-Name: f907395ef5a2dc1d084b6a286af00de4c742cf12d4f347c21e1b757786508f57

5 years agoWhen a scalar subquery has a pre-existing "LIMIT X" then change it to
drh [Mon, 23 Sep 2019 11:55:22 +0000 (11:55 +0000)] 
When a scalar subquery has a pre-existing "LIMIT X" then change it to
"LIMIT X<>0" rather than just "LIMIT 1" so that if X is 0 the limit
will still be zero.  Ticket [99cd4807dc03f178]

FossilOrigin-Name: 82e5dcf5c1d500ed82f398b38fdae0f30033804e897fbab3c10f1e15e2abedef

5 years agoFix a harmless unused variable warning in the test logic.
drh [Sat, 21 Sep 2019 18:49:12 +0000 (18:49 +0000)] 
Fix a harmless unused variable warning in the test logic.

FossilOrigin-Name: d7673a445f4cde8f71153ce81efdc34fbed8b8625714d54afae1a83d548671ff

5 years agoFix harmless compiler warnings.
drh [Sat, 21 Sep 2019 17:31:03 +0000 (17:31 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: 8ea1dc727d391b15d0c4fa858ff68d5b8a63dde46408f24027dac8d28f044cbd

5 years agoAllow SQLite to omit redundant ORDER BY sorts in the case where a SELECT statement...
dan [Sat, 21 Sep 2019 15:44:12 +0000 (15:44 +0000)] 
Allow SQLite to omit redundant ORDER BY sorts in the case where a SELECT statement has GROUP BY and ORDER BY clauses that use the same expressions, even when the ORDER BY expressions are marked "DESC".

FossilOrigin-Name: 20f7951bb238ddc0b8932a55145df426b6fdf7b8631e069345902c853c90f191

5 years agoAdd --multithread, --serialized, and --singlethread options to the
drh [Sat, 21 Sep 2019 13:34:59 +0000 (13:34 +0000)] 
Add --multithread, --serialized, and --singlethread options to the
speed-check.sh test script.

FossilOrigin-Name: c17078af6046ba3cb0d7819c915a800c851d7368e13d149140db2a124df32bab

5 years agoSimplify the fix in the previous commit.
dan [Fri, 20 Sep 2019 21:12:40 +0000 (21:12 +0000)] 
Simplify the fix in the previous commit.

FossilOrigin-Name: 5ef64b0f55d952c7b0016055eaf6bbc1b5b7afc09a62ee8e5e694ffa9863ac7c

5 years agoFix a problem with queries containing a min() or max() function for which the FILTER...
dan [Fri, 20 Sep 2019 20:52:16 +0000 (20:52 +0000)] 
Fix a problem with queries containing a min() or max() function for which the FILTER clause excludes all rows.

FossilOrigin-Name: b1d7e104e034655fe41bc55c562d91e8074a2973d538b8b29301458db45afc57

5 years agoFix an assert() in fts3 that could fail when accessing a corrupt database.
dan [Thu, 19 Sep 2019 13:51:52 +0000 (13:51 +0000)] 
Fix an assert() in fts3 that could fail when accessing a corrupt database.

FossilOrigin-Name: 601ce9532d34f97a5faa170b6d8a272e5c54f2eabff84660201a1840e0fd9929

5 years agoAlways clear the temporary register cache after coding a subroutine.
drh [Wed, 18 Sep 2019 20:34:54 +0000 (20:34 +0000)] 
Always clear the temporary register cache after coding a subroutine.

FossilOrigin-Name: b6f2a7f9cdb547c925f08306df82519e41a7a0dd2cabd9861a48917bb6eef845

5 years agoAdd extra tests for the handling of corrupt records in fts3.
dan [Wed, 18 Sep 2019 17:22:00 +0000 (17:22 +0000)] 
Add extra tests for the handling of corrupt records in fts3.

FossilOrigin-Name: 40e29a47d1266c16a4992e43579a51addcc632503099c4cd128f77dd4e67da3c

5 years agoFix another potential "jump depends on uninitialized value" warning.
drh [Wed, 18 Sep 2019 12:49:34 +0000 (12:49 +0000)] 
Fix another potential "jump depends on uninitialized value" warning.

FossilOrigin-Name: 633b214e9b9d99788ed72ab4823a69a43c7c40ed07fb76c7d56c50453c0e58ab

5 years agoFix a "jump depends on unititialized value" valgrind error in fts5 triggered by corru...
dan [Wed, 18 Sep 2019 11:46:34 +0000 (11:46 +0000)] 
Fix a "jump depends on unititialized value" valgrind error in fts5 triggered by corrupt database records.

FossilOrigin-Name: 6b6751cd90601a1e2744a7d233c973291ecb783801b9327c3b99734dd22bcd27

5 years agoFix an OOB read in the INSTR() function introduced yesterday by check-in
drh [Wed, 18 Sep 2019 11:16:46 +0000 (11:16 +0000)] 
Fix an OOB read in the INSTR() function introduced yesterday by check-in
[3fb40f518086c1e8] and detected by OSSFuzz.  The test case is in TH3.

FossilOrigin-Name: d49047c1b59bbfd05204af9973cdb0fab51b4d2661b550aec10d917fff94dc9b

5 years agoDo not change the OP_String8 opcode into OP_String until *after* any necessary
drh [Tue, 17 Sep 2019 21:28:54 +0000 (21:28 +0000)] 
Do not change the OP_String8 opcode into OP_String until *after* any necessary
encoding conversions are accomplished.  Otherwise, a rerun of the prepared
statement after an OOM can result in errors.  Test case in TH3.

FossilOrigin-Name: 8efd62594eae725decb719aa7777c020f982b7cdc2c92bab3b91bf349a5bc298

5 years agoTest cases for ticket [587791f92620090e]
drh [Tue, 17 Sep 2019 13:30:30 +0000 (13:30 +0000)] 
Test cases for ticket [587791f92620090e]

FossilOrigin-Name: ca0e3a83a1c015b346a791e6de03904d17a769c52dad0e3d71316c6e2e3f43c7

5 years agoFix the instr() SQL function so that it makes a copy of its argument
drh [Tue, 17 Sep 2019 03:16:29 +0000 (03:16 +0000)] 
Fix the instr() SQL function so that it makes a copy of its argument
before changing the datatype, since the datatype affects processing.
Also fix the sqlite3_value_text() routine so that it always works even
for values obtained form sqlite3_value_dup().  Ticket [587791f92620090e]

FossilOrigin-Name: 3fb40f518086c1e8d11eb1f4134e965450dbedfa4277bce39ef1e969fc747d38

5 years agoImproved type information display when tracing VDBE execution.
drh [Mon, 16 Sep 2019 20:16:17 +0000 (20:16 +0000)] 
Improved type information display when tracing VDBE execution.

FossilOrigin-Name: ee83d8e30d6f9ca8f1cce653ee094ff151f633f4b6a21dd814ab07e8cfb901eb

5 years agoDo not attempt the LIKE optimization for non-text columns and a pattern
drh [Mon, 16 Sep 2019 18:19:41 +0000 (18:19 +0000)] 
Do not attempt the LIKE optimization for non-text columns and a pattern
prefix of "-".  Ticket [0f0428096f17252a]

FossilOrigin-Name: 6fe0367f9a337b7c62886b7771f3ce0642faa13f4e4f3d9a0c848abbab514cd0

5 years agoAdd recent interesting cases from dbsqlfuzz.
drh [Mon, 16 Sep 2019 15:15:38 +0000 (15:15 +0000)] 
Add recent interesting cases from dbsqlfuzz.

FossilOrigin-Name: f06ef3d75d85545dd58c6dda10f7ad04fafbb7ae8706b3821be21f86a94795f1

5 years agoDocumentation updates for the SQLITE_DIRECTONLY flag.
drh [Mon, 16 Sep 2019 14:42:07 +0000 (14:42 +0000)] 
Documentation updates for the SQLITE_DIRECTONLY flag.

FossilOrigin-Name: 5beb6dc9bc2d3d0003e33488df9c01aaf28c41c30fd9ca35543cbe3ec5a8d9ce

5 years agoFix a problem with processing CTEs that use a WINDOW clause.
dan [Mon, 16 Sep 2019 05:34:08 +0000 (05:34 +0000)] 
Fix a problem with processing CTEs that use a WINDOW clause.

FossilOrigin-Name: ca564d4b5b19fe56842a04f31bb61352e6ae9d72a7e7634eb27ebcf5f670545a

5 years agoAdd the --no-rowids option to the ".recover" command.
dan [Sat, 14 Sep 2019 16:44:51 +0000 (16:44 +0000)] 
Add the --no-rowids option to the ".recover" command.

FossilOrigin-Name: 01d71b947a7422081d5c7d6ac2c91b9c936dc41926ab58c92f4a088a64e8c051

5 years agoExtra comments on fields of the Window object.
drh [Sat, 14 Sep 2019 16:21:02 +0000 (16:21 +0000)] 
Extra comments on fields of the Window object.

FossilOrigin-Name: 3dbed162518a73213bbfb137c763064518fdc2daeae3952cfab39ce0e6813d3f

5 years agoFix the windows inverse function on the JSON aggregates.
drh [Sat, 14 Sep 2019 00:21:34 +0000 (00:21 +0000)] 
Fix the windows inverse function on the JSON aggregates.

FossilOrigin-Name: f464d847af490dd3ec45565dcc4c2e6ff4ed1ebb65036f30ca0b3ce2e73080e6

5 years agoFix a problem with using json1 window functions with an EXCLUDE clause.
dan [Fri, 13 Sep 2019 20:42:46 +0000 (20:42 +0000)] 
Fix a problem with using json1 window functions with an EXCLUDE clause.

FossilOrigin-Name: 4a1978814da41608a16f6953bd575c97d587a34bd80b7ac0e619d62bfdc903d2

5 years agoFix the windowB test module so that it works even if SQLite is built without
drh [Fri, 13 Sep 2019 18:59:04 +0000 (18:59 +0000)] 
Fix the windowB test module so that it works even if SQLite is built without
JSON support.

FossilOrigin-Name: 807975c76b36347f02aa0ce9661d608adbffe1f7e77c15f8da677e47e1187153

5 years agoAdd the SQLITE_SUBTYPE flag, which may be passed to sqlite3_create_window_function...
dan [Fri, 13 Sep 2019 18:27:17 +0000 (18:27 +0000)] 
Add the SQLITE_SUBTYPE flag, which may be passed to sqlite3_create_window_function() to indicate that the window function uses sqlite3_value_subtype() to check the sub-type of its arguments.

FossilOrigin-Name: ba2ebc3a348decc5cedaf14960e30e7ae26a26824cfa198727f2499162142ef3

5 years agoFix a typo in the carray extension header comment - the comment that serves
drh [Fri, 13 Sep 2019 17:30:24 +0000 (17:30 +0000)] 
Fix a typo in the carray extension header comment - the comment that serves
as the documentation to this extension.

FossilOrigin-Name: 658a42d3633b31fda260f2c5a1a2c7dd8eb4eb0114d322369017c56faf5ecd42

5 years agoChange the meaning of the SQLITE_SUBTYPE flag so that it indicates that the user... window-functions-subtype-fix2
dan [Fri, 13 Sep 2019 17:05:48 +0000 (17:05 +0000)] 
Change the meaning of the SQLITE_SUBTYPE flag so that it indicates that the user-defined function cares about the subtypes of its arguments.

FossilOrigin-Name: af1bc20f502816db460d2b2d353f715da5cf660e59095de5214c829c1cb20981

5 years agoMerge latest trunk changes with this branch.
dan [Fri, 13 Sep 2019 16:19:53 +0000 (16:19 +0000)] 
Merge latest trunk changes with this branch.

FossilOrigin-Name: 14ef7543465dd14d8fa141fcceb1950b5c2d265a3e862323969d747b39c0cd8c

5 years agoEnsure that the idxStr for FTS5 is always zero-terminated.
drh [Fri, 13 Sep 2019 13:23:13 +0000 (13:23 +0000)] 
Ensure that the idxStr for FTS5 is always zero-terminated.
Fix for check-in [e6db945454a0dae2]

FossilOrigin-Name: 090cd07d37904da4610d6a6787a3cc825c9a8bdcc5f051267d4608bba9b49d03

5 years agoFix harmless compiler warnings.
drh [Fri, 13 Sep 2019 12:24:58 +0000 (12:24 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: a8927d14f88c44828e794787bab080455ab62705c93f65ce7d8db83478aa5a8e

5 years agoAllow fts5 to filter on multiple MATCH clauses in a single scan.
dan [Thu, 12 Sep 2019 19:38:40 +0000 (19:38 +0000)] 
Allow fts5 to filter on multiple MATCH clauses in a single scan.

FossilOrigin-Name: 9d418a7a491761eeb38a70898677a493e2631e5d62e75ee88431f52d3dfd2344

5 years agoFix typo for one instance of line number handling in the Lemon tool.
mistachkin [Wed, 11 Sep 2019 15:25:26 +0000 (15:25 +0000)] 
Fix typo for one instance of line number handling in the Lemon tool.

FossilOrigin-Name: 980be1730dc1239c63a107923bf2e32b4ec7d4bc31b9190e711cc35f18cc2bb4

5 years agoEnhance treeview to show SOFT-COLLATE for TK_COLLATE operators that omit
drh [Tue, 10 Sep 2019 17:51:27 +0000 (17:51 +0000)] 
Enhance treeview to show SOFT-COLLATE for TK_COLLATE operators that omit
the EP_Collate flag.

FossilOrigin-Name: a97804620a27acc30bebd2aaa04e38f2f36de48b0931038ca8bdc9cb0c36b8f4

5 years agoEnsure the columns of views and sub-queries maintain their implicit collation sequenc...
dan [Tue, 10 Sep 2019 15:33:52 +0000 (15:33 +0000)] 
Ensure the columns of views and sub-queries maintain their implicit collation sequences when the "push-down" optimization is applied. Fix for [18458b1a].

FossilOrigin-Name: 36997c4ade2ef3a274cd1ac52b44118fb3a05325adb650b7b338ecb43d060575

5 years agoEnsure the columns of views and sub-selects in the FROM clause of a select are always...
dan [Mon, 9 Sep 2019 20:17:24 +0000 (20:17 +0000)] 
Ensure the columns of views and sub-selects in the FROM clause of a select are always assigned implicit collation sequences, just as table columns are. Fix for [a7debbe0].

FossilOrigin-Name: b9ec72203c19c2b95e648ac1dfad74eec98d4ff82581cdc10dc4221ba551728f

5 years agoEnsure the columns of views and sub-selects in the FROM clause of a select are always... tkt-a7debbe0_
dan [Mon, 9 Sep 2019 19:49:42 +0000 (19:49 +0000)] 
Ensure the columns of views and sub-selects in the FROM clause of a select are always assigned implicit collation sequences, just as table columns are. Possible fix for [a7debbe0].

FossilOrigin-Name: 1863b7bf12521bdd2b51c5b8d3a4634bff3e15d3713e0b5343952df7da02f794

5 years agoAdd the SQLITE_SUBTYPE flag, which can be passed to sqlite3_create_function() and...
dan [Sat, 7 Sep 2019 18:20:43 +0000 (18:20 +0000)] 
Add the SQLITE_SUBTYPE flag, which can be passed to sqlite3_create_function() and similar to indicate to the core that a user function is likely to use sqlite3_result_subtype().

FossilOrigin-Name: 6aa438ce41d460a6782ae63503128b9140c28ff59c2b2eed48b004acf83e0560

5 years agoFix handling of NULL, text and blob values in window queries that use "RANGE BETWEEN...
dan [Wed, 4 Sep 2019 06:56:43 +0000 (06:56 +0000)] 
Fix handling of NULL, text and blob values in window queries that use "RANGE BETWEEN A FOLLOWING AND B FOLLOWING", or "B PRECEDING AND A PRECEDING", where A>B.

FossilOrigin-Name: cb3e2be674316e1d39968eb6567f1fe1b72f9d89af49640a9e83f944979c4cf0

5 years agoUpdates to the default settings in Makefile.linux-gcc.
drh [Tue, 3 Sep 2019 16:23:41 +0000 (16:23 +0000)] 
Updates to the default settings in Makefile.linux-gcc.

FossilOrigin-Name: 3044cf6917ea8324175fc91657e9a5978af9748f72e1914bc361753f0b2d897d

5 years agoWhen we play games with COLLATE in order to commute an operator in the
drh [Tue, 3 Sep 2019 14:27:25 +0000 (14:27 +0000)] 
When we play games with COLLATE in order to commute an operator in the
WHERE clause processing, be sure not to use the commuted operator to qualify
a partial index, as insufficient COLLATE information is preserved to verify
that the expression will correctly qualify the index.
Ticket [767a8cbc6d20bd68]

FossilOrigin-Name: 5351e920f489562f959ab8a376ff720f845ea165e0cdc7c3a271aac53c2aa64a

5 years agoFix a bug introduced earlier today by check-in [88833a9c2849c959].
drh [Mon, 2 Sep 2019 22:13:06 +0000 (22:13 +0000)] 
Fix a bug introduced earlier today by check-in [88833a9c2849c959].
Ticket [29f635e0af71234b]

FossilOrigin-Name: 6e7b4527d32cc1be0294614b9d7363d4b59cf654a954b86515b3f6888975ce73

5 years agoFix a potential crash in fts5 caused by using an auxiliary function on a "special...
dan [Mon, 2 Sep 2019 14:46:12 +0000 (14:46 +0000)] 
Fix a potential crash in fts5 caused by using an auxiliary function on a "special" query like '*id' or '*reads'.

FossilOrigin-Name: 9490683ae883561fa347cbe54ebdd61188d849b4852d904b508250ba5d0807ef

5 years agoWhen applying the IN_INDEX_NOOP optimization and the LHS has REAL affinity,
drh [Mon, 2 Sep 2019 02:21:58 +0000 (02:21 +0000)] 
When applying the IN_INDEX_NOOP optimization and the LHS has REAL affinity,
also apply REAL affinity to each element of the RHS.
Ticket [2841e99d104c6436].

FossilOrigin-Name: 88833a9c2849c959a37a80e0e4d2b211ce3c83a48319724c89b172b060c876b4

5 years agoFix an obsolete comment that defines the meaning of one of the parameters
drh [Mon, 2 Sep 2019 01:25:07 +0000 (01:25 +0000)] 
Fix an obsolete comment that defines the meaning of one of the parameters
to the sqlite3FindInIndex() subroutine.  No changes to code.

FossilOrigin-Name: 0c946f0846b2835f8facca806a4d4ecc2b2e97343de245a0d91716d998b2a829

5 years agoWhen computing an expression value for an index-on-expression or a CHECK
drh [Mon, 2 Sep 2019 00:58:44 +0000 (00:58 +0000)] 
When computing an expression value for an index-on-expression or a CHECK
constraint and the expressions uses a REAL table column, but the value of
that column is an integer (in other words, when it is using the
store-real-as-integer optimization) be sure to promote the value to real
before evaluating the expression.  Ticket [57af00b6642ecd68].

FossilOrigin-Name: 0658c16e311393c8a347b1bd41fa5dbfd2e184aa75d84c011aa8dbac79b632e9

5 years agoRemove an obsolete paragraph from the OP_Column documentation. No code
drh [Sun, 1 Sep 2019 23:36:33 +0000 (23:36 +0000)] 
Remove an obsolete paragraph from the OP_Column documentation.  No code
changes.

FossilOrigin-Name: f6d8956cf8b5993a4332b9330e89d5c3d5f8872ea5a2ce3d2e91127406cc1839

5 years agoFix a harmless compiler warning.
drh [Sat, 31 Aug 2019 20:29:28 +0000 (20:29 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: 63c67a54b4d3e501f3059dcdfc6bb50c6b8dad63a34eb773e4408d9e4e780d7a

5 years agoMark new VDBE branches never taken.
drh [Sat, 31 Aug 2019 20:26:06 +0000 (20:26 +0000)] 
Mark new VDBE branches never taken.

FossilOrigin-Name: 83c2adffbfb6dcdddb38ad9f888647b0e39fa24dc0bff344238e1f75a6c7d2ed

5 years agoImprovements to the algorithm that determines which SELECT in a sequence
drh [Sat, 31 Aug 2019 20:13:30 +0000 (20:13 +0000)] 
Improvements to the algorithm that determines which SELECT in a sequence
of nested SELECT statements that an aggregate function belongs to.  This
resolves an issue identified by dbsqlfuzz.

FossilOrigin-Name: d768007473f4ed40abbdf2c7e501b580b1cc37c1620c7cb90af1f208a8c35145

5 years agoIf a DELETE trigger fired by an UPDATE OR REPLACE statement deletes the row being...
dan [Sat, 31 Aug 2019 17:14:35 +0000 (17:14 +0000)] 
If a DELETE trigger fired by an UPDATE OR REPLACE statement deletes the row being updated, do not attempt to proceed with the original UPDATE operation. Fix for [d6a0fbc1].

FossilOrigin-Name: 4145b3e05051ba6729105157a876793ad14a05d895fc10fe704f437eab16ea93

5 years agoRemove some affinity tests that became unreachable due to the prior change.
drh [Sat, 31 Aug 2019 01:33:19 +0000 (01:33 +0000)] 
Remove some affinity tests that became unreachable due to the prior change.

FossilOrigin-Name: e2db1123faac26c0e0b6a1ebef1685ea7633bfcafd1ff743ba5380700f7745af

5 years agoWhen the affinity of a table column is INT or REAL, make the affinity of
drh [Fri, 30 Aug 2019 23:56:34 +0000 (23:56 +0000)] 
When the affinity of a table column is INT or REAL, make the affinity of
corresponding index columns NUMERIC.  This increases the precision of
index lookups for large numbers so that it matches the precision of
ordinary comparison operators.  Ticket [40812aea1fde9594]

FossilOrigin-Name: e0d909c740b774d8a46731696e33342be83206cc4a95d07f42fdb3d8cc2d7a8e

5 years agoMake sure OP_RealAffinity has been applied to all columns of type REAL
drh [Fri, 30 Aug 2019 23:15:00 +0000 (23:15 +0000)] 
Make sure OP_RealAffinity has been applied to all columns of type REAL
in the excluded.* pseudo-table of an UPSERT.
Ticket [5a3dba8104421320]

FossilOrigin-Name: 67381dadede98a55d8d9e085d021e6fa6473071978967b6302e03b28cf2245e1

5 years agoImprovements to VDBE tracing. No changes to code in normal deliverables.
drh [Fri, 30 Aug 2019 21:52:13 +0000 (21:52 +0000)] 
Improvements to VDBE tracing.  No changes to code in normal deliverables.

FossilOrigin-Name: 54553bf16fabd72d1967acef317beb518e086707ccd45890b7c7256b8da08b75

5 years agoAdd test case to window8.test. Also fix an error in a comment in window.c.
dan [Fri, 30 Aug 2019 19:45:03 +0000 (19:45 +0000)] 
Add test case to window8.test. Also fix an error in a comment in window.c.

FossilOrigin-Name: 2925bfa5971c8557ecaa6ac18df0825ebbbd1622017509e83451d90640146fa8

5 years agoBack out the change at [47cd634c98b502d4] which was incorrect. Add a test
drh [Fri, 30 Aug 2019 18:02:49 +0000 (18:02 +0000)] 
Back out the change at [47cd634c98b502d4] which was incorrect.  Add a test
case so that we don't accidently back out that change again.

FossilOrigin-Name: 596ac2a4eab28b74f4050fb4eb71883f2a1421fdbccf302413e4653391bb52c9

5 years agoAdd further comments to window.c.
dan [Fri, 30 Aug 2019 17:28:55 +0000 (17:28 +0000)] 
Add further comments to window.c.

FossilOrigin-Name: 900464567b2a5ce0c278a3297e4be1968f609258608aa0fbe2fc67709aa22a4b

5 years agoNew test cases for window functions with RANGE BETWEEN and DESC NULLS FIRST.
drh [Fri, 30 Aug 2019 16:46:12 +0000 (16:46 +0000)] 
New test cases for window functions with RANGE BETWEEN and DESC NULLS FIRST.

FossilOrigin-Name: f7002f86c780e279c9f8a6268f317586519c059c9de2115ff6f1cad272570c29

5 years agoFix a bug in RANGE window functions that use "ORDER BY <expr> DESC NULLS FIRST" as...
dan [Fri, 30 Aug 2019 16:14:58 +0000 (16:14 +0000)] 
Fix a bug in RANGE window functions that use "ORDER BY <expr> DESC NULLS FIRST" as the window-frame ORDER BY clause.

FossilOrigin-Name: 39b4cad4a51bb5116d62ffb16ac36d96a9280321b049eb2d008605392f52a459

5 years agoThe expression "(X IS FALSE) IN (FALSE)" does not imply that X is NOT NULL.
drh [Fri, 30 Aug 2019 16:00:58 +0000 (16:00 +0000)] 
The expression "(X IS FALSE) IN (FALSE)" does not imply that X is NOT NULL.
Ticket [f8f472cbc77ba9c9]

FossilOrigin-Name: dd66134817ecbda01c59a05ad0d6ac44bee700ab10cd2119c869dd69af293fe2

5 years agoThe expression "(X IS FALSE) BETWEEN FALSE AND TRUE" does not implie that
drh [Fri, 30 Aug 2019 15:11:08 +0000 (15:11 +0000)] 
The expression "(X IS FALSE) BETWEEN FALSE AND TRUE" does not implie that
X is not NULL.  Ticket [fba33c8b1df6a915]

FossilOrigin-Name: 057fb8b1809b8b9c8fff0fd0804153b9644f0545c23c6ddc4758bda3381094b9

5 years agoThe expression "(x IS FALSE) IS FALSE" does not imply that X is not NULL.
drh [Fri, 30 Aug 2019 13:07:06 +0000 (13:07 +0000)] 
The expression "(x IS FALSE) IS FALSE" does not imply that X is not NULL.
Ticket [a6408d42b9f44462]

FossilOrigin-Name: 45ff2b1f2693bb0231a864a511bb82cf2a5945ab3d806a5bbaf1517ecb287883

5 years agoRemove a faulty testcase() macro.
drh [Thu, 29 Aug 2019 23:24:18 +0000 (23:24 +0000)] 
Remove a faulty testcase() macro.

FossilOrigin-Name: 80124ae55246b79023d23d3f55487ac3c0b40e8ff301c5daf4dd0631de8ddb29

5 years agoImprove vdbe branch coverage of NULLS LAST code.
dan [Thu, 29 Aug 2019 21:16:46 +0000 (21:16 +0000)] 
Improve vdbe branch coverage of NULLS LAST code.

FossilOrigin-Name: e8e9f77d52974f6ba0a536d05837b280a996745deb3a2169bb29379f10e49df4

5 years agoFix other problems similar to ticket [c0390363].
dan [Thu, 29 Aug 2019 19:34:29 +0000 (19:34 +0000)] 
Fix other problems similar to ticket [c0390363].

FossilOrigin-Name: 96ff2ba9c4bb71d5f7c6f359986a76a5364b7ac3e1a612441543a9eabecf31df

5 years agoAdd a missing VdbeCoverage() macro.
drh [Thu, 29 Aug 2019 16:48:10 +0000 (16:48 +0000)] 
Add a missing VdbeCoverage() macro.

FossilOrigin-Name: 33da6092d3d04b6eb6ab396b8c4f668e3529e26bf11e26f5fcb9b61fe3470197

5 years agoRemove an unreachable branch in the NULLS LAST logic of RANGE window
drh [Thu, 29 Aug 2019 16:17:59 +0000 (16:17 +0000)] 
Remove an unreachable branch in the NULLS LAST logic of RANGE window
functions.

FossilOrigin-Name: 47cd634c98b502d40a493455ba6d73cbd0dae74944f9cf06fcbcd025f4b49d6e

5 years agoFix another case where SQLite assumes that if "~(? AND FALSE)" is true, "?" must...
dan [Thu, 29 Aug 2019 15:50:16 +0000 (15:50 +0000)] 
Fix another case where SQLite assumes that if "~(? AND FALSE)" is true, "?" must be non-null.

FossilOrigin-Name: 616f5663b3dbd0929128c0990fc6d8bba1513c7ae196b87c450ac0b3b3203ecd

5 years agoAvoid assuming that for "~ (? OR TRUE)" to be true, "?" must not be NULL, just as...
dan [Thu, 29 Aug 2019 15:06:35 +0000 (15:06 +0000)] 
Avoid assuming that for "~ (? OR TRUE)" to be true, "?" must not be NULL, just as we do for "NOT (? OR TRUE)". Fix for ticket [c0390363].

FossilOrigin-Name: 84ae41fd2f50cb7c0c3f6522d0f94817e1bbf96eae5316279e3e32cee4e46e91

5 years agoFix a potential buffer overrun in fts5 caused by corrupted database records.
dan [Thu, 29 Aug 2019 14:25:44 +0000 (14:25 +0000)] 
Fix a potential buffer overrun in fts5 caused by corrupted database records.

FossilOrigin-Name: c465d0eb478e42045e08efe8b6fa64d4bd4d747cdf743beae4608562b014169e

5 years agoImprove Lemon so that it enlarges some of its tables slightly in order to
drh [Thu, 29 Aug 2019 00:27:12 +0000 (00:27 +0000)] 
Improve Lemon so that it enlarges some of its tables slightly in order to
avoid having to index range checks on table lookups for a performance
increase.

FossilOrigin-Name: 4be6a23a188bd1fea445283d6dcc2f5c3470c28852dc4895d63117ad0c773fcf

5 years agoFix an unreachable branch in sqlite3ParserFallback() lemon-optimization
drh [Wed, 28 Aug 2019 11:49:45 +0000 (11:49 +0000)] 
Fix an unreachable branch in sqlite3ParserFallback()

FossilOrigin-Name: e059178b47109caee2c2211b2db6e594c014af636677118a64e10edf01ac017d

5 years agoFurther improvements to parser speed by enlarging lookup tables to eliminate
drh [Wed, 28 Aug 2019 11:31:11 +0000 (11:31 +0000)] 
Further improvements to parser speed by enlarging lookup tables to eliminate
the need to do range checking on the index prior to lookup.

FossilOrigin-Name: 47d3e091ae49eb7947af5abef9b5b96b16b86d349e51fe0677795649be6db473

5 years agoIncrease the size of the yy_lookahead table so that it is never necessary to
drh [Wed, 28 Aug 2019 02:09:47 +0000 (02:09 +0000)] 
Increase the size of the yy_lookahead table so that it is never necessary to
down bounds checking on the index.

FossilOrigin-Name: bafd872398e58766e996963372c7acc03a1e20a6d39a3867ca45d3ea0ed2ac1d

5 years agoAdd support for "ORDER BY ... NULLS FIRST" and "ORDER BY ... NULLS LAST". Use this...
dan [Tue, 27 Aug 2019 19:59:21 +0000 (19:59 +0000)] 
Add support for "ORDER BY ... NULLS FIRST" and "ORDER BY ... NULLS LAST". Use this to fix ticket [f8a7060e].

FossilOrigin-Name: 94085fb3e756bc984237b74b6e29c68462ad860870c64dcb5124feaeec387660

5 years agoThe ALWAYS() added by the previous check-in was incorrect. Take it back out.
drh [Tue, 27 Aug 2019 17:59:01 +0000 (17:59 +0000)] 
The ALWAYS() added by the previous check-in was incorrect.  Take it back out.

FossilOrigin-Name: 336235db2b1167cdb2feb64b47eb6368c97c43ee9641b7bfccc5775a41dd0d0e

5 years agoAdd ALWAYS() to an always true conditional that results from the
drh [Tue, 27 Aug 2019 17:28:05 +0000 (17:28 +0000)] 
Add ALWAYS() to an always true conditional that results from the
previous check-in.  Add a test case for ticket [dbaf8a6820be1ece] to
supplement those already checked into TH3.

FossilOrigin-Name: aff209804722ac902c7abfde80ad2677e0f51beb2c7f28f65d51105d984a1640

5 years agoOmit the "x IN (y)" to "x==y" optimization of check-in [e68b427afbc82e20]
drh [Tue, 27 Aug 2019 17:01:07 +0000 (17:01 +0000)] 
Omit the "x IN (y)" to "x==y" optimization of check-in [e68b427afbc82e20]
(and ticket [e39d032577df6942]) as it causes difficult affinity problems
as demonstrated by ticket [dbaf8a6820be1ece] and the original assertion fault
is no longer a factor due to countless other changes of the previous 5 years.

FossilOrigin-Name: 7f5168a76a400fc2e1e40c6950470b1bfb38a0be54fc5518c17c29fdae7d8f1f

5 years agoIf a TEMP TRIGGER references an auxiliary schema, and that auxiliary schema
drh [Tue, 27 Aug 2019 10:05:45 +0000 (10:05 +0000)] 
If a TEMP TRIGGER references an auxiliary schema, and that auxiliary schema
is detached, move the trigger to reference the TEMP schema before completing
the detach, so that the trigger does not hold a dangling schema pointer.

FossilOrigin-Name: 069c2f4c61f06211a8981abc412afcc1536ece13380b13a70aa99123f8f527cd

5 years agoMerge in recent fixes from trunk. nulls-last
drh [Mon, 26 Aug 2019 20:41:33 +0000 (20:41 +0000)] 
Merge in recent fixes from trunk.

FossilOrigin-Name: ad816d01d4bd3908ff2c574d79d1a29b6d732df308f2f1b1cdf7c0bc7c1bd7cf

5 years agoTweak the shell tool ".recover" command so that it can recover rows that consist...
dan [Mon, 26 Aug 2019 14:57:58 +0000 (14:57 +0000)] 
Tweak the shell tool ".recover" command so that it can recover rows that consist of a rowid and no fields.

FossilOrigin-Name: 279ac7fdec0b1409cd400b7b093f89089d93c49f596f378c6a3032434a85bf83

5 years agoImproved detection of number of column mismatch for vector assignment
drh [Mon, 26 Aug 2019 14:18:28 +0000 (14:18 +0000)] 
Improved detection of number of column mismatch for vector assignment
in UPDATE statements.  Ticket [78acc9d40f0786e8]

FossilOrigin-Name: bd4bda73df3794eef424eb13e08fc7cc54347d1ac69febaeec41f6b6cb4a42bc

5 years agoFix typo in a comment. No code changes.
drh [Mon, 26 Aug 2019 13:45:49 +0000 (13:45 +0000)] 
Fix typo in a comment.  No code changes.

FossilOrigin-Name: d0cc06d8a30444125e5655f6587a6355471c3447c08a2e5f7a046a4ed5cc5f09

5 years agoEnforce 80-character line discipline in the CLI. Minor improvements to the
drh [Mon, 26 Aug 2019 12:50:01 +0000 (12:50 +0000)] 
Enforce 80-character line discipline in the CLI.  Minor improvements to the
CLI built-in help.

FossilOrigin-Name: 9690013a00d73a8047b25149ded50d20c74b5c62c0725eec50ed8477688e58a0

5 years agoMinor performance improvement for balance_nonroot().
dan [Sat, 24 Aug 2019 21:02:47 +0000 (21:02 +0000)] 
Minor performance improvement for balance_nonroot().

FossilOrigin-Name: d7434cae3edc321e2f1f8d340a0e656b1613b736f8400fb271a0e80f59401b9e

5 years agoFix a potential buffer overrun in fts5 caused by corrupt database records.
dan [Sat, 24 Aug 2019 17:11:29 +0000 (17:11 +0000)] 
Fix a potential buffer overrun in fts5 caused by corrupt database records.

FossilOrigin-Name: 156d612800a7282fe0ebb20feb31d3fd577f4ab60fab8c00940c87143997aefb