Commit Graph

22863 Commits

Author SHA1 Message Date
drh
4752bbd872 Detect misuse of aggregate functions in the ORDER BY clause of a query
even if the query also contains window functions.

FossilOrigin-Name: 0d11d777c8d368f0b6e9faf3afccf7da1b041d303a68782e43aebd713aaecf51
2021-05-07 15:46:36 +00:00
dan
01ec691979 Fixes for cksmvfs and rbu so that they work together.
FossilOrigin-Name: f35f6972cdcf16915cc37908b65a3780742a1f75f65e974714b16e86f0c9e3f0
2021-05-06 20:47:49 +00:00
drh
e31cba5675 Remove an assert() in FTS5 that can (rarely) be false in the event of an
OOM while processing a corrupt database file.

FossilOrigin-Name: 5f12f89154843e83b1d69ea1652e881d583aa329df732af72dd59029cd7eb577
2021-05-06 13:45:37 +00:00
drh
c3c23f346c Improved detection of oversized cells in balance_nonroot(), especially in
index b-trees when a cell is being moved from a child page into the parent
page in order to become a new divider cell.

FossilOrigin-Name: 9080d3d5f5aaddbb3410158bcc446649651b7dce3940eb3491620ec9208914b4
2021-05-06 11:02:55 +00:00
drh
59df3e92db Provide the sqlite3PrintMem() routine on SQLITE_DEBUG builds, which can be
invoked from a debugger to get a summary of the status of an sqlite3_value
or Mem object.

FossilOrigin-Name: 5ac24179f5ef16dccc1b65248e33376c9748767b14c75c1056f3b0d08b7a89a7
2021-05-05 19:46:50 +00:00
dan
4fd82a2a78 Fix an undefined-integer-overflow problem in fts3.c.
FossilOrigin-Name: a0bf931bd712037e44e8d7cac3c00a6715c1b451f222bad3184d3ecab1a4c7f4
2021-05-05 11:47:34 +00:00
drh
67656ac78a When applying the optimization that disables WHERE clause terms that drive
indexes, make sure not to do so if the term being disabled is a transitive
constraint.  Fix for the problem identified by
[forum:forumpost/eb8613976a|forum post eb8613976a].

FossilOrigin-Name: f1f9b5de3c59489b94963685660b3ddc45eece5535b02fec399b6ece0e38563d
2021-05-04 23:21:35 +00:00
drh
23634898c5 Also for the 0x20000 bit of ".wheretrace", show when WHERE clause terms are
disabled.

FossilOrigin-Name: 625fb253eecd6c10fce5d0127d516361df0c1d1661502b396fc418dcdb4ae999
2021-05-04 18:24:56 +00:00
drh
6068b6b451 Additional debugging output for whereScanNext() showing equivalence classes
when the ".wheretrace" setting contains the 0x20000 bit.

FossilOrigin-Name: 9280e3d994656344d4feb346156df8a278da80181f6efe0ff8e0340b6f0f91cb
2021-05-04 16:51:52 +00:00
drh
433a3e935d Back out the EXISTS-to-IN optimization. It slows things down rather than
speeds them up depending on the query.  And (see
[forum:/forumpost/8692d94725|forum post 8692d94725]) it sometimes results in
an incorrect answer.  We may come back and revisit this optimization later,
but for now it seems best just to disable it.

FossilOrigin-Name: 16252d73fa73569fd7506676f6ffbbcd43addfb105384fb74449d30ca720904a
2021-05-04 12:07:16 +00:00
drh
f83d501c6d Fix minor coverity warnings in the CLI.
FossilOrigin-Name: 204086a94202fc631371b75c7a8286df2f66116399628ac27ef54533641b8f20
2021-05-03 13:35:00 +00:00
drh
e103a8de2d Fix a potential memory leak following OOM in the decimal extension.
FossilOrigin-Name: 5127f7376776e6220eb8f83a30aa6b823c23ae0ac76e7ae41b33ca4e03ce236a
2021-05-03 13:24:30 +00:00
drh
736d11ed21 Back out the NEVER() inserted by [c7309ed3c7588c7e] because it is reachable
after all.  dbsqlfuzz bc17a306a09329bba0ecc61547077f6178bcf321

FossilOrigin-Name: 20a4f3f12cdd8823d53d91025fa41e284c9f629b1d049eb486ff8dc4a1736e1f
2021-05-01 12:09:36 +00:00
drh
76baad95f4 Guard against a NULL-pointer dereference following OOM in the JSON extension.
FossilOrigin-Name: ea221f3c8e243a5dc4952e510cbe396614a24876bacdc04fb1ebd4127c7ef0d9
2021-04-30 16:12:40 +00:00
drh
0449f6561f Fix a harmless "unused variable" warning when compiling with
-DSQLITE_COVERAGE_TEST.

FossilOrigin-Name: 0bef3fb11fb95d7ede82b59aea26e99e2e23b3bce48009181e691ea17ae78a61
2021-04-30 12:30:35 +00:00
larrybr
5f5719bd07 Reduce API lifetime requirement for objects passed to sqlite3_bind_...() with SQLITE_STATIC.
Also fix broken session doc links (by zapping refs.)

FossilOrigin-Name: 327eb4792f9b98f6220fd35ba744002d36ed53f43a016924117b3cea32343947
2021-04-29 19:30:35 +00:00
drh
5960724789 Fix the operation of the "-" argument to --load-dbsql in the fuzzcheck program.
FossilOrigin-Name: 1f18b3cbee7e1342fdd66e45ef744fea3db2ba4513943c0582ff8ef98974865e
2021-04-29 18:03:42 +00:00
drh
81f5ef05a9 Fix the IN-early-out optimization so that it works even for the corner case
where the NULL bypass fires before the affinity of the LHS operator has been
set.  Fix for the problem described in
[forum:/forumpost/6a3ec138e9|forum post 6a3ec138e9].

FossilOrigin-Name: eb40248ce606b792a02e4e0b7dd826a82891c5f4c9793f3ca5d332e593109525
2021-04-29 15:49:34 +00:00
drh
7bfccfe73c Enhanced "PRAGMA vdbe_trace=on" output associated with the seekHit flag.
FossilOrigin-Name: 683950009300657b0321d7d3f77f2585a28696ff93cedef399d1cd4aa484b2d4
2021-04-29 13:58:28 +00:00
drh
5f086ddee0 Fix harmless compiler warnings.
See [forum:/forumpost/256140e470|forum post 256140e470].

FossilOrigin-Name: 1b8da7924cc78710ae4bbe12b57140fdaeae5efb0e6ac10073ae9c98b7f8d7a4
2021-04-29 13:37:36 +00:00
drh
5e26d07d62 Update test/fuzzdata8.db with recent dbsqlfuzz finds.
FossilOrigin-Name: bce2ea393a872b5b70ef3b9cedce3d406725dcc56d8800ee4f7ec29562cc3f9b
2021-04-29 10:48:50 +00:00
drh
c645871123 Ignore the TEMP or TEMPORARY keyword on CREATE statements which parsing
the schema out of an existing database file.  Those keywords should never be
there.  This change simply adds robustness in case a legacy or damaged database
is seen.

FossilOrigin-Name: 65ec39f0f092fe29e1d4e9e96cf07a73d2ef7ce2c41b6f1cd3ab23546ada0e67
2021-04-28 17:37:26 +00:00
drh
79f313f13c Adjust a VDBE coverage macros due to the enhancement at [506333742103c1f4].
FossilOrigin-Name: daed59b4f96a6899d2404274ad985be3f22f407c1502b3f8ffd7977441a9fe9a
2021-04-28 15:43:36 +00:00
drh
3765c03243 Further improvements to the handling of RETURNING clauses on changes
to TEMP tables with triggers.
dbsqlfuzz 683913e98f54fe4f14e8dd11a48011f73bdca58d

FossilOrigin-Name: ff3538ae37a02f4f36a15cddd1245171e724aac9c84b2e576980fd3806302775
2021-04-27 17:18:10 +00:00
drh
a476768340 RETURNING bug fix: Correctly deal with RETURNING statements on changes to
TEMP tables that also have triggers.
dbsqlfuzz 78b9400770ef8cc7d9427dfba26f4fcf46ea7dc2

FossilOrigin-Name: d0b15eccbfe1e50c3daf7b2fd4769a52bba35d553b07e462ca3f5f22df6742fd
2021-04-27 13:04:18 +00:00
dan
a4cd0bbcb3 Fix a segfault that could occur when querying a corrupt data structures with an fts5token table.
FossilOrigin-Name: cbedfa05501f3eb9750fb21e2ab8516f8f14c479c847f454e52572af278aab71
2021-04-27 11:28:57 +00:00
drh
2f40dc9884 Better error messages on showdb.
FossilOrigin-Name: 7e18e114b245d17aa259ea9ab42752ccc9ad5303bbac8d8e46928dd10319f545
2021-04-27 00:05:03 +00:00
drh
19a7f72ce2 Improved robustness of the "showdb" debugging program when it is parsing
corrupt database files.

FossilOrigin-Name: 3eabac2ee50fd70b22a927d3d2934718a15e1f666d8d271b854579156c8b01de
2021-04-26 23:57:02 +00:00
drh
d8bc250b91 New dbsqlfuzz cases added to test/fuzzdata8.db.
FossilOrigin-Name: 88d20500c516fe89ad1cd42f7366ca190c3790f911f11ab332b86b675f5f69ba
2021-04-26 22:30:49 +00:00
drh
c7f5077e88 Fix the [/info/df1d6482f9e92daf|UNION ALL flattener optimization] so that it
works better with recursive CTEs.
dbsqlfuzz 88ed5c66789fced139d148aed823cba7c0926dd7

FossilOrigin-Name: f80d7bb2c305c1dd4658767660b33259032c048a91f18c654a6bda7332c54a0c
2021-04-26 21:23:01 +00:00
drh
feef447271 Add ALWAYS() to branches that are no longer reachable due to recent
enhancements.

FossilOrigin-Name: 63c50fbdeed831ba450d1dce67e968a7daa2b69ac1270eb271fb1e1873d4a07e
2021-04-26 21:00:51 +00:00
larrybr
ada2323d95 refix altertab.test
FossilOrigin-Name: db032156932fb0dcae5ffb7cbdfb711079daa595713fcb254f09f8ef90c81d95
2021-04-26 20:18:08 +00:00
dan
f0ac29090b Fix a problem that could cause a crash in sqlite3BtreeDelete() when operating on a corrupt database file.
FossilOrigin-Name: 6c6334660dfe81cc33a14b87b25d748b1c98b0702b7bc6db2e3ced16dc992740
2021-04-26 15:32:36 +00:00
drh
3c6edc8a11 More aggressive detection of OOM errors in resolveAlias().
dbsqlfuzz 7f96832c2ef7ee472022ed805b064e55e41094b2

FossilOrigin-Name: e99faf4f82746761c389e24db1b00ee94b9f849e7bcb29517fa0ca10290afc41
2021-04-26 15:28:06 +00:00
drh
8ed8ddf759 When doing the optimization that attempts to avoid sorting on a
GROUP BY, do not assume that the values in an index on an expression are
non-NULL.  Bug discovered by Wang Ke's fuzzer and reported at
[forum:/forumpost/74330094d8|forum post 74330094d8].

FossilOrigin-Name: 7178dc3a32c3a4a33e437fd5026f6f72e4809ceb7d2cd12a25a74b80d5c95d33
2021-04-26 14:32:48 +00:00
dan
bb0eec438d Do not initialize eponymous virtual tables when parsing the schema. This can happen if the db is corrupt.
FossilOrigin-Name: cb8c41aa20bb351c4c712ed7a3617187ceeb0905ede1e6f561bc1d89f31c95ea
2021-04-26 14:09:48 +00:00
larrybr
3ff6a5edd9 Skip test when no JSON.
FossilOrigin-Name: 6fcb2438f88a70ed67e19103bfa263a6c98b06962207f153559c9516d8c7b5d5
2021-04-25 23:13:04 +00:00
drh
113a33c539 Make window range queries more robust against corrupt database files.
dbsqlfuzz f22df3a7b2aab0937a415484514fc2f68a293c99.

FossilOrigin-Name: 506333742103c1f440db5da819a36f3b518f7b49e94a7b74419b02bbcadc5a78
2021-04-24 23:40:05 +00:00
drh
ba9ebc2d12 Treat byte-order marks (BOMs) at the start of a token as whitespace.
This enhancement is inspired by
[forum:/forumpost/ed8f696a20|forum post ed8f696a20].

FossilOrigin-Name: 3d55c21c167631f42d155aadec544e629bd078de9992aa5a74694d08bc52052b
2021-04-24 12:24:08 +00:00
drh
971ae9f66a Fix testcase altertab-25.1 due to check-in [c7909e8e0d0577c6] disallowing
ALTER TABLE on eponymous virtual tables.

FossilOrigin-Name: 32255e39cbde65492d88177464cee9e10cb20cf3105208416be131e2c89b63e1
2021-04-24 12:20:10 +00:00
drh
1521270010 Fix harmless compiler warnings in fuzzcheck.
FossilOrigin-Name: e7b4ffecc610c494ebd506977402ec48cc799780f96c6293c0ccf27697160aa1
2021-04-23 13:57:53 +00:00
drh
ba6619d7be Enhance the --load-dbsql and related options of fuzzcheck so that if the
argument is a single - then filenames are read from standard input.

FossilOrigin-Name: e1548802b6de7037baf388d27a7f3658abafe07b6f48d5ec97e5f644303592d8
2021-04-23 12:58:16 +00:00
drh
292ed6decf Give a better final output line for the --spinner option on fuzzcheck.
FossilOrigin-Name: 93729614e21ee674b83b0d2babb71bb758f1a2ec55bf9bda057fb7739f2e14e0
2021-04-23 12:16:16 +00:00
drh
d84f10ed13 New dbsqlfuzz cases added to test/fuzzdata8.db.
FossilOrigin-Name: 8da88508932e475c8c6af1553268ff02e3e013b78ccc94b14532ec928fc62537
2021-04-23 11:50:23 +00:00
dan
f3d5a68461 Fix an assert() in fts5_index.c that may fail if the database records are corrupt.
FossilOrigin-Name: dfadb96edfef1d49e48a659264b9eb8d7f98d95d159d95c92c30dd4ba6c6e739
2021-04-23 11:37:01 +00:00
drh
7a04e296f3 Improved OOM detection in sqlite3ExprCheckIN().
dbsqlfuzz 46ae2d8f473ac672f3042cc14ab67aeab9ffa6c2

FossilOrigin-Name: fac12115a994a1b4347586e68faf38895ee9cb588eaa84c6f71cf9afd4c488b4
2021-04-23 00:59:38 +00:00
drh
eca3c67b1c Change a memcpy() into a memmove() to prevent a warning about overlapping
regions passed to memcpy() in case of some obscure and unlikely database
corruption.

FossilOrigin-Name: bab132cbd18a529389a0315e60f30ccf1b565823116e0ec9b4f7684db1914c80
2021-04-22 20:01:02 +00:00
drh
214b50314a Fix harmless compiler warnings of unused function parameters in FTS5.
FossilOrigin-Name: 14273915979f8fbf80111e795b5511a6ee24638896b9d434d6ccf4bf7f7a7f62
2021-04-22 19:34:31 +00:00
dan
743b5fd589 Further tweaks for comments in sqlite3session.h.
FossilOrigin-Name: 553ada28f356d773c145b502163d766285e73fd4f64dc05f98e3e43ade806331
2021-04-22 18:52:36 +00:00
dan
9ad39a33ff Change to comments in sqlite3session.h. No changes to code.
FossilOrigin-Name: 353ebb71c4113a35a92011c72f9c1d6c56f3bf681d94426a6a73e40f219ff2f4
2021-04-22 18:39:02 +00:00