Commit Graph

21458 Commits

Author SHA1 Message Date
drh
6411d656aa If the ".wheretrace 0x10000" bit is set, print WhereTerm.prereqAll
and .prereqRight fields in the WhereTerm trace output.

FossilOrigin-Name: a4f330b133a36356681dce7d2a65d8ab792620494d6cd4ef4934a97cf3a8e6fc
2019-12-28 12:33:35 +00:00
drh
7505123fe5 Two new test cases added to test/fuzzdata8.db.
FossilOrigin-Name: 1be2c18f4021e1d0b8412ecb68a599475c717dd97c7db209fc4203358957fd70
2019-12-28 11:55:44 +00:00
dan
409f3370af Second attempt to fix a problem with unwinding the WITH stack of the Parse object following an error.
FossilOrigin-Name: 315d1f1a503e8c186739658c85b92fa3d12514e5baaa26925c85664b5e85d1c0
2019-12-28 09:08:27 +00:00
dan
43526f4ada Merge latest trunk changes with this branch.
FossilOrigin-Name: d693be375380fbfca426999a77eeecb8453fa77b77f608bfe266945dee1da41d
2019-12-28 08:33:46 +00:00
dan
5d59102a91 Fix an assert() failure in altertable3-22.4.
FossilOrigin-Name: c566a91d5c4290b0a491a01e85bf8f9fbebf2910e0d478bafc2d22da7f749cae
2019-12-28 08:26:47 +00:00
drh
9a1f2e4853 Fix a faulty assert() associated with query search limiting query plans.
FossilOrigin-Name: 0d743585c242ebd898b232f42937a2306752aaed0a6756705e3ef1cf7593aa97
2019-12-28 03:55:50 +00:00
drh
b97f3532f5 Convert an assert() back into a conditional. The conditional was converted
into an assert() by check-in [6ae4ad6ebee4db88] (2009-05-28) because we were
unable to find a test case for it.  Yongheng's fuzzer just now
found that test case.

FossilOrigin-Name: 4d0b9109f7a5312d4e136395e08b11dad64d746bc106ad44d47675e5b1dcb4ef
2019-12-28 02:40:49 +00:00
drh
d9670abb58 When an INSERT is receiving content from a SELECT, run an OP_ReleaseReg opcode
at the top of each iteration of the loop in order to prevent spurious
OP_SCopy misuse complaints.  Ticket [de4b04149b9fdeae]

FossilOrigin-Name: 6afadd3b3a40b0ef29fd14fb24c2a4b9479483e5f8b9125ce02d8daae662207f
2019-12-28 01:52:46 +00:00
drh
ad5f157791 Recompute the values for all generated columns after
NOT NULL ON CONFLICT REPLACE constraints fire.
Tickets [37823501c68a09f9] and [5fbc159eeb092130].

FossilOrigin-Name: 4cc12c18860bc4801a407cf45e88e23d3d40391f01a461fbac2cac5f102100e1
2019-12-28 00:36:51 +00:00
dan
a6c1a71cde Do not attempt to unwind the WITH stack in the Parse object following an error. This fixes a separate case to [de6e6d68].
FossilOrigin-Name: d29edef93451cc67a5d69c1cce1b1832d9ca8fff1f600afdd51338b74d077b92
2019-12-27 20:54:42 +00:00
dan
b4b3630657 Remove a NEVER() that is no longer true. Fix for [36ffedcb9].
FossilOrigin-Name: 597896ed0ae9e2960a8f39576bd7f77a11dccc1da84b6a44ebb5c38d90ebc330
2019-12-27 20:06:32 +00:00
dan
e3735bf466 Fix a problem involving window function aliases being referenced from sub-selects.
FossilOrigin-Name: e3b5fc05c00fc58be7a7c94ce1d97a5b05113f39aba03df64aab08364f85616b
2019-12-27 19:46:07 +00:00
drh
6473ba95a0 Add a missing "ifcapable rtree {...}" line to the window1.test test module.
FossilOrigin-Name: 4e6fbb1a5100fe29209bcf668fbecf3a733034b84925265d8a15b0a84baf6cf0
2019-12-27 18:15:04 +00:00
dan
431704375e Fix a problem with window functions in aggregate queries that do not have GROUP BY clauses.
FossilOrigin-Name: 99609786f485653464d1caef1d207ae299d28c925bff3e8e94891759b4765dcc
2019-12-27 16:25:56 +00:00
dan
d8d2fb9222 Do not mistake constant integers in a PARTITION BY expression for references to ORDER BY style references to values returned by the SELECT statement.
FossilOrigin-Name: 45c64d39d5afed7fdc6b1de19408559740d1fba1f5e0269ab68b132366a289e4
2019-12-27 15:31:47 +00:00
drh
09bee5743d Follow-up to check-in [c8c6dd0e6582ec91] - change the xAccess() method to
return true if the file exists and it is anything other than a regular file,
or if it is a regular file with a non-zero file size.

FossilOrigin-Name: 8a39803ef8db4d8cb0d231e66299525fad4e61266ca29b3704aebb88df1c745b
2019-12-27 13:30:46 +00:00
dan
5e484cb3eb When determining if an aggregate within a sub-query should be processed as part of the sub-query or an outer query, consider any FILTER clause in the same way as the arguments to the aggregate.
FossilOrigin-Name: 1ffc045d2bbeeda9c13a3a3585538ff6434fc852b0ae6679d3c8b9f606bf92e6
2019-12-27 08:57:08 +00:00
drh
fce8165ec6 Ensure that the Pager.changeCountDone flag is cleared whenever dropping
the write lock, even when transitioning from EXCLUSIVE locking mode into
NORMAL locking mode while in WAL mode.  Ticket [fb3b3024ea238d5c].

FossilOrigin-Name: 846b1de6e5a9e418f225273dc033234c64c116fcd89c8261522b4902c248451f
2019-12-27 01:50:46 +00:00
drh
8d7f44c03a Fix buffer underflows in the zipfile extension associated with zero-length
or NULL filename in the ZIP archive.  But report on the mailing list by
Yongheng and Rui.

FossilOrigin-Name: 465a15c5c2077011befa854a77f9d295bb751ef20b7d2937ac0ba47cc84587c9
2019-12-27 00:19:53 +00:00
drh
fe2a3f1d24 If an UPSERT can cause an Abort due to a constraint failure, make sure
the query planner knows this.  Ticket [7c13db5c3bf74001].

FossilOrigin-Name: f14ce948662f3445a06d84d4f32d9b81143e0cffaf773d8aa4d3a609bfb9682b
2019-12-26 23:40:33 +00:00
drh
d3ee3ad12f An UPDATE of a table that is indexed by a constant virtual column that uses
the one-pass optimization might cause the table seek to be omitted before
reaching row DELETE/INSERT.  Fix this by coding an extra OP_Column in that
circumstance.  Ticket [ec8abb025e78f40c]

FossilOrigin-Name: e54560495926fbb8a2ce829c677a2dd0066e46b7a8d4ada9d8a34a3426959836
2019-12-26 23:16:18 +00:00
dan
e752040c09 Fix an assert() in fts5 that could fail if an xSavepoint() call on another vtab fails.
FossilOrigin-Name: a5d7f5d24a239f729de0b8aa5becf5af35ba87160565ee0713c335b8d1bbf12d
2019-12-26 14:36:31 +00:00
drh
fa53284777 Makefile.in fix so that it works on systems that require a .EXE suffix
on executables.

FossilOrigin-Name: f482a4cdfa768941e22c399de8ec29a55e729529eeae86d3832077ad1bef22f3
2019-12-26 01:10:17 +00:00
drh
0bb7af44a3 Add two new fuzzer test cases from dbsqlfuzz.
FossilOrigin-Name: f8d5586a8ceca985dcb2d63d0fbad9e271e9e1664720ee698d4947acd5dcc543
2019-12-26 01:02:02 +00:00
drh
96e8eebf96 In the xAccess() method of the unix VFS, return true if the named object
is a directory, regardless of what stat() reports as the st_size for the
object.  Different filesystems report st_size differently for directories.
Problem reported on the mailing list by Stefan Brüns.

FossilOrigin-Name: c8c6dd0e6582ec9103d007b294c42bb1820be1fa7dab85d873b04e0b90571626
2019-12-26 00:56:50 +00:00
drh
0b12613a00 Fix an FTS3 test case that depends on the ICU extension so that it only
runs if SQLite is compiled with ICU.

FossilOrigin-Name: 19c6240bdbb022b2af463e59d873280d0f2385bf30e22b9aad5fc9677a99f251
2019-12-26 00:54:39 +00:00
drh
aaa5ba0609 Fix an incorrect assert() added by check-in [fa58aad48a788802].
Problem found by dbsqlfuzz.

FossilOrigin-Name: a17b29f08c888301911c35096899f10d24192c8ecec467cddde5401b6bd1903f
2019-12-26 00:53:43 +00:00
drh
e86f3402ac Disables the optimization that tries to pull the value of an expression
from an index on that expression if the expression is a constant.

FossilOrigin-Name: e5fd8b50500f9225e435ef5afee98e3c2cccd22785f99c718d7e6c9b5b653c56
2019-12-26 00:20:56 +00:00
drh
a9ebfe2030 When the sqlite3WindowRewrite() routine detects and error, have it convert
the SELECT statement into just "SELECT null" so that it does not leave the
parse tree in a goofy state that can cause problems with subsequent code
before the stack has a chance to unwind and report the error.
Ticket [d87336c81c7d0873]

FossilOrigin-Name: fa58aad48a788802b13a819e49f9b8787f713bbe395c46c7295e821c52c81738
2019-12-25 23:54:21 +00:00
drh
b44fec68a5 Fix a minor performance regression from check-in [401c9d30e06191d9]
FossilOrigin-Name: 76f54ee86777cbf530654323c953388ef64d0608516722d2522be6c859fa1382
2019-12-24 21:42:22 +00:00
drh
c7a5ff45b9 Backout the early VTable cursor close change from yesterday, as Yongheng and
Rui have found a test case for which it fails.  The new test case is added
to fuzzcheck.

FossilOrigin-Name: ddb10f0374e66886d0681937b14cf0b4f100f03d3955b45b6c508dc6d9e36976
2019-12-24 21:01:37 +00:00
dan
4fcce747e2 Fix a problem causing fts5 integrity-check failures if numeric values are inserted into a table within a utf-16 database. Fix for [752fdbf6].
FossilOrigin-Name: bae060f382e4386c0793db4aa280fe9cd4893307d17a1801a17218ae4dc031c2
2019-12-24 20:51:01 +00:00
drh
a194d3152c Make the zipfile() extension function more robust against zero-length filenames.
FossilOrigin-Name: b9c2005f0291d58d7f3bfd4a2286eb6563e9c9433519c3329035f325fc723445
2019-12-24 18:53:13 +00:00
dan
3fee9de239 Fix another case where malformed utf-8 was being mishandled in fts5. Fix for [df46a6f3].
FossilOrigin-Name: 1c0a05b09a97e6e2e9b11c31ed6ec7e6484686614b587ebfd0cfe27d973ba461
2019-12-24 16:20:05 +00:00
dan
84d17bdaa7 Fix an assert() added as part of commit [a11b393dc] that can fail if fts5 database records are corrupt.
FossilOrigin-Name: 4630c1ec013a4c2e54a34c9a64b2c803ac3912450de660497eb34ee21c91f426
2019-12-24 15:35:53 +00:00
drh
4eac5f04ab Extra defense against problems following an OOM. dbsqlfuzz find. Also
import the latest dbsqlfuzz test cases.

FossilOrigin-Name: 0a70f5ddaf3567f335cc0fd0fcd5303e2afb5e38a6388faddf5cab1f2a74e3dd
2019-12-24 15:01:17 +00:00
dan
c26e78d275 Fix a spurious report of corruption that could be made by the fts5 integrity-check in SQLITE_DEBUG builds if the fts5 index contains malformed utf text.
FossilOrigin-Name: a11b393dc2c882cf0b3c47c3405bf43ca1d6459605bd39cccce4d32da653a72d
2019-12-24 14:27:03 +00:00
drh
34da2a4806 Convert an ALWAYS() into an assert() with an extra error term.
Dbsqlfuzz find, with test case in TH3.

FossilOrigin-Name: b473ad35c5ce355853e1805a5c0658bda1500775f22f59c6b6759ae990e65aca
2019-12-24 13:41:33 +00:00
drh
22c04f8199 Allow comparison operators of a register against itself.
Ticket [188f912b51cd802a],

FossilOrigin-Name: 401c9d30e06191d938503aae024bc453d960fa64dc812ed86c661f94533247fd
2019-12-24 01:53:05 +00:00
drh
1e490c4ca6 Test case for the zipfile-extension bug fix of the previous check-in.
FossilOrigin-Name: bc8bfc7fcdf33f6855584e10e9260073430517ff3268cf0c7988dcc4cd785391
2019-12-23 21:11:15 +00:00
drh
d8f2d46cbc Fix the zipfile() function in the zipfile extension so that it is able to
deal with goofy filenames that contain embedded zeros.

FossilOrigin-Name: cc0fb00a128fd0773db5ff7891f7aa577a3671d570166d2cbb30df922344adcf
2019-12-23 21:04:33 +00:00
drh
5f0dfc00de Thoroughly reset the rtree cursor at the start of each VFilter operation,
including clearing its cache.  This prevents left over pages in the cache
which can cause problems on shutdown after a LEFT JOIN.
Ticket [5eadca17c4dde90c]

FossilOrigin-Name: 4c50afafce8416369f89477ba7fe7d9b047399a5ee5754c73d0e67bbea8d877c
2019-12-23 20:41:39 +00:00
drh
192cf36de6 Remove an extra deflateInit2() call accidently left in
check-in [f5ee30426e8876e7]

FossilOrigin-Name: 953e6aa6d9ca09e549c88bc728c322fabdcef581f3b4a7763d95488dddbbd6a5
2019-12-23 20:07:28 +00:00
drh
e2478dfa43 Do an early close of virtual table cursors to avoid unnecessary cursor
contention in UPDATE for some virtual table implementations.
Ticket [56a74875be799b85]

FossilOrigin-Name: eb95dac7f6482c36853a23234c5ce7af37c7beed8e3675d6a49c4d3a8307e076
2019-12-23 19:28:34 +00:00
drh
a2d50283db Early detection of database corruption in balance_deeper().
FossilOrigin-Name: 61c2233654158e65a3d3baeea947903a919a569fcc4a5b342b2e9a68cec1b6f3
2019-12-23 18:02:15 +00:00
dan
1d24a53125 Fix a case in which SQLite could fail to identify "x BETWEEN ? AND ?" being true as implying that x is not null. Ticket [dfd66334].
FossilOrigin-Name: 2f17974912ec5e99089dc0da803e7ff1bf033377a49762d2689a812c005f2641
2019-12-23 15:17:11 +00:00
dan
2811ea6be7 For expressions like (x, y) IN (SELECT ...) where the SELECT uses window-functions, require that all columns on the LHS be indexed before an index can be used. Fix for [d9ed4ebe].
FossilOrigin-Name: 0b1dbd60f5db3abe2097dbc0b6de9671685ca5eaf7d3fc8e3f87ff5065a9d114
2019-12-23 14:20:46 +00:00
drh
7edce5ecc0 Fix a shift-overflow problem in yesterday's check-in [36fdeb4f0a66970a]
that OSSFuzz helpfully discovered overnight.  Thanks Google.

FossilOrigin-Name: bff38e2b5318ed032aaf1d350903c3494b4531f2dc59a6997144ec8e23defef4
2019-12-23 13:24:34 +00:00
drh
0af6ddd3ca Fix the OP_Cast operator so that when casting to TEXT, it always leaves
the result in the encoding of the database.  Ticket [0911b5d161b039c6].
Test cases in TH3.

FossilOrigin-Name: f347744e0d576f0250c29259cca755e57afded8956224114c01603c1bca5b3a4
2019-12-23 03:37:46 +00:00
drh
3d8e7a2f97 Change the assert() back into a testcase(). See also check-ins
[9ab985a9c8160b90] and [ddb17d92df194337] and other check-ins that those
reference.  Fix for ticket [9d708e474201c001]

FossilOrigin-Name: 2c44c73499154bc57634a54cb743642d0aacc93a1336fbb8bb3eb5dbbf616357
2019-12-23 02:43:52 +00:00