Commit Graph

21474 Commits

Author SHA1 Message Date
drh
628b1a3f9e Remove a NEVER in btree due to a new test case from dbsqlfuzz.
FossilOrigin-Name: 46f8ef70fb8b3ae00cc081b280f3dff38b1d0f1b52a8f4477ec89dec32e4d813
2020-01-05 21:53:15 +00:00
drh
2e5beddb34 Fix DBSTAT so that it returns now rows, rather than an error when the
WHERE clause is "schema=NULL".

FossilOrigin-Name: 5b246b47aeadc25dbec0956e2d6edcd49fbe874a01734fdf15b770507648222d
2020-01-04 19:14:48 +00:00
drh
17aceebab7 Fix harmless compiler warnings.
FossilOrigin-Name: 8452fe03430d34abecab618d6136b863630f91d68d69ebbc115f808bc81c3817
2020-01-04 19:12:13 +00:00
dan
664d80bbf7 Omit the omit flat from eq constraints on column "name" of dbstat virtual tables. Fix for [74a4c386].
FossilOrigin-Name: cfff5cb2279088aa66f435bd0d627b2c74c9a99ad9addfd44a4df8ba770b795a
2020-01-04 18:38:58 +00:00
drh
56ea69bf0e Record when the OP_IfNotOpen branch is and is not taken.
FossilOrigin-Name: 182a898b14d585edd5fcfdcd6584c957911f0d81773d2868f16b5762dec031ca
2020-01-04 18:33:20 +00:00
drh
64f7ee0219 Remove another NEVER added by check-in [7b62555e285f32d3].
Dbsqlfuzz found another test case.

FossilOrigin-Name: 481f4956aff52797880930752693a8c0b10d7fdd71d86919fe8ee13c90ad5b81
2020-01-04 17:55:01 +00:00
drh
6f2180d21a New test cases in test/in4.test require rtree, so disable those tests on
builds that lack the rtree extension.

FossilOrigin-Name: b5900914f7f34caf1a97c87233781d55467329b0ac4366354df13c6fd72a99c7
2020-01-04 17:42:27 +00:00
dan
74ebaadcdd Fix a problem where the loop for the RHS of a LEFT JOIN uses values from an IN() clause as the second or subsequent field of an index.
FossilOrigin-Name: 95ef68966c50f311830cba8c9257a4085c93011d205e0e31867c2917fa62a48e
2020-01-04 16:55:57 +00:00
drh
f6ea97ea3d Fix a false-positive in the register validity tracking logic by moving the
temporary register release call before the jump that uses that temporary
register.

FossilOrigin-Name: 9da48a5ca66dc67c8f7fb2d2471dac7ea696e35ecba5ddf65747d08d452436c1
2020-01-04 15:21:47 +00:00
drh
4549a3b8cb Improve a testcase in test/fuzzdata8.db to make it more resilient.
FossilOrigin-Name: 139aefe60097e06b43df35652e6b2183b7a4b03341d1bde23deada3fa3358fee
2020-01-04 14:57:26 +00:00
drh
b2b61bb61f Back out another NEVER added by check-in [7b62555e285f32d3] - the test case
was already in test/fuzzdata3.db, but it only occurs if compiled without
SQLITE_ENABLE_PREUPDATE_HOOK.

FossilOrigin-Name: 61f873b14c2c835f3d10b018b357cb8b1f041e97e05709d7ab5a8055e5e05349
2020-01-04 14:50:06 +00:00
dan
6fe63b4ee7 Omit the omit flag from eq constraints on column "aggregate" of dbstat virtual tables. Fix for [727074e2].
FossilOrigin-Name: 74ef6f2b6d9f50ff1d455e2263ba77707c1e8394b25b3f8a3a2a7b6e7f2c481e
2020-01-04 14:00:56 +00:00
drh
e5cf3e990a Restore a NEVER and an assert in btree that was removed by
check-in [7b62555e285f32d3].  Dbsqlfuzz found test cases.

FossilOrigin-Name: 04a05c83f58784df438dc6614f7920f782bf7c1ed4f6d101c03b6573cfde06ee
2020-01-04 12:34:44 +00:00
dan
e455e3acf0 In fts3, avoid making a very large memory allocation if the merge-hint record is corrupt.
FossilOrigin-Name: 9add58fe9688d5c1f675736e7f1c6ff7831d2ff6fdeb884a2e62c1bf9536ee50
2020-01-03 20:16:32 +00:00
drh
3b76c45a7f Add NEVER macros to error-detection branches that were made unreachable
(as far as I can tell) by check-in [ceacc28b03580334].

FossilOrigin-Name: 7b62555e285f32d354df7746ef8dce16856c6d9d53a02d895b74ba02362d2968
2020-01-03 17:40:30 +00:00
drh
0d21eae099 Improvement to check-in [7405e98225761180] so that missing or null filenames
given to the zipfile extension throw an immediate error.

FossilOrigin-Name: 523e09bd228750fb7be1d4e68d18f6c1bf9db19293d66fbf30b86409321e9814
2020-01-03 16:38:54 +00:00
dan
9a20ea9b5b Improve a specific case of early database corruption dectecion in the b-tree layer.
FossilOrigin-Name: ceacc28b035803342764f9b696c1e80edcd259b87ea4fb46f92963d6cb33de3e
2020-01-03 15:51:23 +00:00
drh
4c983b2f86 Remove an over-zealous ALWAYS() macro and add a test case that shows that
the conditional can sometimes be false.

FossilOrigin-Name: 536e9a9d1bd514056ecbc8172ed58f2656a86f791a15e526ae2e5f2c93687b6a
2020-01-03 14:34:04 +00:00
dan
607dd6e608 Fix a possible NULL pointer dereference caused by using a "VALUES(...)" as a component of a compound SELECT with non-integer ORDER BY clause terms.
FossilOrigin-Name: 9d791116420f4e3f613775569e0a0cba2fc22da568b2fb2df920bcf9c9002938
2020-01-03 14:27:08 +00:00
drh
90996885fc Fix the OP_Copy-coalesce optimization so that if the previous row happens
to end with OP_Copy but is not a candidate for the optimization due to jumps,
then the optimization is correctly bypassed.

FossilOrigin-Name: b36126c1889e323c9a8f04b4f4884576993c845e7d393e5e73aaa6ab5158c1f9
2020-01-03 14:16:43 +00:00
dan
aa328b6ab1 Ensure that when a Select object is reset a new, empty, SrcList is allocated.
FossilOrigin-Name: 4889cbf898d7ec54f061b21b6d3621b22fc482cbeaa7115d40995a4cc30e41db
2020-01-03 13:55:14 +00:00
drh
0cbec59c8b When generating the name of a view (or common table expression) because the
SQL does not specify a name, avoid the names "true" and "false" which might
be confused for the boolean literals of the same name, leading to an
inconsistent abstract syntax tree.

FossilOrigin-Name: ff9492d3ff733c222ea67f23d478df1547641b5e2e6dd870b0b29e25c13f3739
2020-01-03 02:20:37 +00:00
drh
e1f49b8850 Fix a problem in sqlite3TreeViewBareExprList() in which the routine was
not interpreting the new ExprList format correctly.

FossilOrigin-Name: cd56872afbb4edeff2e8c1cb1c8d47c7a9b333b3fc416c20183250807291fae8
2020-01-03 00:28:14 +00:00
drh
24d35e409c Add the two-size lookaside memory allocator. Also, reduce the per-entry
size of the ExprList object.

FossilOrigin-Name: 51665bf0f975fb248964a4be205a4f3285d3f3f8cc697977d264efefbbe20dd8
2020-01-02 22:28:47 +00:00
drh
9fc1b9af36 NEVER() and ALWAYS() macros tagging unreachable branches.
FossilOrigin-Name: 34b877742ef78e9bb3f16815180f4ad9cd722beb1d610f713400a3b25d68aa9b
2020-01-02 22:23:01 +00:00
drh
378ca1eab3 Merge the latest enhancements from trunk.
FossilOrigin-Name: bd57e6d923d3b04f0a07aaf18bf389d2b2b7efc7c57e8cb37e6ef910662d8397
2020-01-02 21:41:59 +00:00
drh
0c4f82051c Do not allow the zipfile virtual table to start a transaction if no
filename has been specified.

FossilOrigin-Name: 7405e982257611803792617f5d8142c54f9831b4a030f4de8607888c525e6289
2020-01-02 21:30:13 +00:00
drh
6b559f3033 Fix some test logic in the OP_Delete opcode so that it works after a
cursor-trip.

FossilOrigin-Name: 28900e5cab73f9edb9383d64a37e14fed0602966cb704ddffa60c0281698fd52
2020-01-02 19:50:50 +00:00
drh
1b39aab08d Ifdef-out code that is only possible with the sessions extension.
FossilOrigin-Name: 4fcf07f79672d203efbc90ad21d97f6a131c3885306f8e0bab015d5ac44b8644
2020-01-02 18:37:04 +00:00
drh
3aef2fb1b4 Have the OP_ReleaseReg opcode also invalidate the registers if P5 is non-zero.
FossilOrigin-Name: 937be22106f7e3f08712febd342d6cb81d129f2d5ab24ce80b3a5c3f9bbde54e
2020-01-02 17:46:02 +00:00
dan
9f3e6fadde Handle blobs that are the return values of functions being cast to text in utf16 databases in the same way as blobs read directly from the database. Fix for [771fe617].
FossilOrigin-Name: e782096aa06fcf410c3a0a6ee26a9e4f44333da39b28b2efe675814a8652911a
2020-01-02 16:24:22 +00:00
drh
4cbd847a91 Fix the OP_Move opcode so that it correctly manages dependency tracking.
This change impacts debugging builds only.

FossilOrigin-Name: 5377add4b8af8c52d0a32f5273835ac6bdc42cfb2a95ffcb335b987437a91aa6
2020-01-02 15:02:08 +00:00
drh
22e95fbd74 Enhancements to aid testing and debugging:
In PRAGMA vdbe_trace=on output, show pScopyFrom dependencies on register
values.  Add the sqlite3VdbeRegisterDump() procedure, callable from a
debugger, that shows the values of all registers.  Pass the VDBE pointer
into test_trace_breakpoint() so that sqlite3VdbeRegisterDump() is callable
from the breakpoint.

FossilOrigin-Name: 9886cb4b7987f720aa9d701222ab0987caa0ab8c5d216cb6e523c4a45366dfe5
2020-01-02 14:42:42 +00:00
drh
52f11b885a Add the test_trace_breakpoint() subroutine that is invoked after each
instruction is printed while running PRAGMA vdbe_trace=on.  Only works for
SQLITE_DEBUG builds.  Also add parameters "pc" and "pOp" to 
test_addop_breakpoint() to make it easier to set conditionals.

FossilOrigin-Name: 49a6368c384178653cb3ccb58cc8eff93327c16929bf79eeefeb13a4ce897153
2020-01-02 13:26:49 +00:00
drh
629b88c683 Use OP_Copy instead of OP_SCopy to move the results of a scalar subquery.
FossilOrigin-Name: 435c272dcf6ed5f3acb564b8f959557145f117b869547b670258cf5a1908ab6b
2020-01-02 02:50:45 +00:00
drh
36e678bc39 The sqlite3WhereEnd() call now unwinds all Expr modifications made by the
sqlite3WhereBegin().

FossilOrigin-Name: 7bfd42f1dc0c94f9bb74516e62fec8e39c20f4749f4e0972f66c2886d3c64f73
2020-01-02 00:45:38 +00:00
drh
2a83c10072 Provide the -DSQLITE_ENABLE_INTERNAL_FUNCTIONS=1 compile-time option. Fix
the ".testctrl internal_function" command in the CLI so that it does not
signal an error on a valid input.

FossilOrigin-Name: 8ee2ce92c082771675d0e8be597043cf9f0fd4f8a73d6a1498bf8743d6b3904a
2020-01-01 23:02:35 +00:00
drh
fc705da15d When generating code for a subquery, make a copy of the Select object and
generate the code out of the copy, in case the code generator makes
modifications to expression and the Select object needs to be reused.

FossilOrigin-Name: 4edddcc0bc8d71e9b8abac67bc3766f1d9143dddd1f59264859ce65e5aa9b8c6
2020-01-01 21:14:30 +00:00
dan
4ea562ee70 Ensure that when code for a scalar SELECT featuring window functions is generated more than once by the planner, separate ephemeral tables are opened for each instance.
FossilOrigin-Name: ce1417325273aba866767349b55d9bbfb61a08e716bebda2122918a9657ee38c
2020-01-01 20:17:15 +00:00
drh
aef8167421 Fix the sqlite3ExprImpliesNonNullRow() routine so that it correctly
handles a numeric comparison of two AND subexpressions.

FossilOrigin-Name: 07e504d5174a1a8b1aa05ec5b44ac81ab3ea706c5a098caa88deb3d489cec8fb
2020-01-01 16:43:41 +00:00
drh
171c50ec38 New test-only SQL functions: implies_nonnull_row(), expr_compare(), and
expr_implies_expr().  The SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control
is modified to toggle internal function access on and off for a single
database connection.

FossilOrigin-Name: 473892a8eceacf24d57fd0c72ff2a0b8be4e0d75e0af7a30bdb24fbc3b453601
2020-01-01 15:43:30 +00:00
drh
25c4296bd9 Factor out code generation for in-line SQL functions into a separate routine
inside of expr.c.

FossilOrigin-Name: 586a65a28fc6cac77309612abc32a2e1017c65e0387f9f438f5d8ac8406da8eb
2020-01-01 13:55:08 +00:00
drh
6d67aff0e3 Issue OP_ReleaseReg opcodes against the array of registers used to compute
index records after the index record has been computed.

FossilOrigin-Name: e3330861b4deab7c7cc09ad8b936d633c600b9fb4e274801efeaaf94e5c860b4
2020-01-01 01:26:05 +00:00
drh
51676fab72 Remove an incorrect assert() statement. Ticket [46fcd700b855e6d1]
FossilOrigin-Name: eca7ec9cda4606c4104bcb8da315070b615713db9f3444579c6a3e96b0aad02f
2019-12-31 23:17:35 +00:00
drh
64de2a5f7b Also set the SQLITE_DIRECTONLY flag on the load_extension() function.
FossilOrigin-Name: 3bd095a53119c368fe30e539983588b27957203344cf427405b9a64784b8eba7
2019-12-31 18:39:23 +00:00
drh
1e732787da Set the SQLITE_DIRECTONLY flag on the fts3_tokenizer() function of FTS3,
thus preventing that function from being called from within a trigger or
view.

FossilOrigin-Name: f3171dc22e4d3a40ca17fe609391d92fc6a997b775bfefa5947aec69c889aa73
2019-12-31 18:12:36 +00:00
drh
cf014f6cbd Refactor names. Use "small" instead of "mini" to describe the smaller
of the two lookaside memory allocation sizes.

FossilOrigin-Name: 88d244983854cdc1a369c5df09ae00f1098784db768ba4e17b963d187dcb1009
2019-12-31 15:12:34 +00:00
drh
5f6a2ed7f2 Merge recent enhancements from trunk.
FossilOrigin-Name: 39d55579376906f212271ce9b2d367e3ad029fb173f22c7253312b467970208a
2019-12-31 14:49:10 +00:00
drh
02ff747bc0 The OP_ResultRow opcode releases the SCopy dependences on all its registers,
as the values in those registers will not be reused.

FossilOrigin-Name: 1dc83c5d54ca2890112e735e336c209adb8d067d2f647e9f8ae5d58f84a52461
2019-12-31 12:18:24 +00:00
drh
70d6b8327a Back out the NEVER() from check-in [40d10e7aad5b8992] because it is reachable
after all. Ticket [892575cdba4e1e36]

FossilOrigin-Name: f481636f1a0333c6e98906e5d4433bf1d046380bc29c760e8e7e2c2b3530b956
2019-12-30 23:50:19 +00:00