Commit Graph

8277 Commits

Author SHA1 Message Date
drh
85ffcae177 Add the new threadtest5 test program for stressing multiple database
connections in the same process hammering on a single database.
Primarily designed to test memdb, but works on any database.

FossilOrigin-Name: 8db1c06958b8e1691440d4fd392648b74a1940b721852dabd315005efad520fc
2021-05-12 14:17:20 +00:00
drh
8d889afc0d Enable the sqlite3_serialize() and sqlite3_deserialize() interfaces by
default.  Omit the SQLITE_ENABLE_DESERIALIZE option and replace it with
the SQLITE_OMIT_DESERIALIZE option.

FossilOrigin-Name: 6df3b03e00b1143be8fed3a39a58ce81063020275aa1ac13d87c84f1ceda6e27
2021-05-08 17:18:23 +00:00
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
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
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
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
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
5e26d07d62 Update test/fuzzdata8.db with recent dbsqlfuzz finds.
FossilOrigin-Name: bce2ea393a872b5b70ef3b9cedce3d406725dcc56d8800ee4f7ec29562cc3f9b
2021-04-29 10:48:50 +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
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
larrybr
ada2323d95 refix altertab.test
FossilOrigin-Name: db032156932fb0dcae5ffb7cbdfb711079daa595713fcb254f09f8ef90c81d95
2021-04-26 20:18:08 +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
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
3d8c92d041 Raise an error on an attempt to rename an eponymous virtual table.
FossilOrigin-Name: c7909e8e0d0577c6109f13c0b14fb565239aae8af8963d659f363e124f3437fc
2021-04-22 18:02:48 +00:00
drh
68b63c0195 Fix the date/time translation logic in the zipfile extension so that it
works with boundary cases. See
[forum:/forumpost/d82289d69f|forum post d82289d69f] for the trouble report.

FossilOrigin-Name: c8de5f061359c174e143e5e81ade8aa9b7d71ba57287459cf0f4f2c94459c345
2021-04-22 14:43:16 +00:00
drh
7437c25b63 Add recent dbsqlfuzz test cases to test/fuzzdata8.db.
FossilOrigin-Name: 6fe50dcc239d2d1fc2a38aa705f4c75cbe26b3e48d098537306d96d6a4005659
2021-04-21 12:03:36 +00:00
dan
fe599b05f2 Fix a problem allowing SQL variables to be used expressions within the second and subsequent ON CONFLICT clauses of an UPSERT within a trigger.
FossilOrigin-Name: 2a28910a17dc5b3ce43062fdf879f9622f6ec2db19ed780fa7fe5cae781be7b7
2021-04-21 11:32:22 +00:00
dan
5b482a9832 Update an assert() in btree.c that may fail with a corrupt database.
FossilOrigin-Name: d74bf88c5a027cf080a2892a3538fe5104952b5b3759a6eba1b1a98a75ddf5f4
2021-04-20 13:31:51 +00:00
dan
0a746cc528 Ensure that all records are updated by setting the OPFLAG_SAVEPOSITION flag when updating records as part of ALTER TABLE DROP COLUMN.
FossilOrigin-Name: 354a4db5cb769c6aed386f43ee26d7e42342e92f781eef100c09751dc5b51751
2021-04-18 05:30:39 +00:00
dan
3c6fbd6dd9 Remove a couple of NEVER() macros from the code for walking window lists.
FossilOrigin-Name: 4ec9ef4bcd12bd9ba5e1a2424f75479070d12c25f1272548c6cf3f89be826b8c
2021-04-17 20:13:53 +00:00
larrybr
68d261d073 Bring in permutations mod.
FossilOrigin-Name: 7a1316f32c857b5ec9e50c5d341f977f998dbf404f4758e3fe317fd8ef25f41e
2021-04-17 20:04:40 +00:00
dan
55f36787ea Do not run external_reader.test as part of permutation "journaltest", as it requires wal mode.
FossilOrigin-Name: 9f5f16cf093cd8b8c7649f664eaf2ad8128fd50e182720dbddf05a6d9227c037
2021-04-17 19:59:14 +00:00
larrybr
f5576936f1 Allow more time for perf tests when instrumented. Condition another on feature it needs.
FossilOrigin-Name: f0dd9cf2d7045d3634294bcf2722d3d7b0a6c4c3ef713b0f7f54fbe31432027f
2021-04-17 18:43:29 +00:00
drh
48a6aede46 Add new dbsqlfuzz cases to test/fuzzdata8.db.
FossilOrigin-Name: d18793e589a4ee7706e994a1f3d24ba7df190467d92fa6ac040258f4debc149d
2021-04-17 18:39:39 +00:00
dan
44918c74cd Fix cases where code in expr.c was failing to handle OOM failures that occurred while processing sub-select expressions.
FossilOrigin-Name: 62efe2eee34fdb147cc456290576d8fc3801487867c78aadd4485f85468d9ffc
2021-04-17 14:42:37 +00:00
drh
7b0d34fe32 Ensure that variables are not used in the WINDOW clause of a query inside
of a trigger.  dbsqlfuzz d9cf66100064952b66951845dfab41de1c124611

FossilOrigin-Name: 1a341378ab24a5091e6cf03b9e957d11b2bfe5c711835e8c583785f8fa0125d3
2021-04-17 13:46:23 +00:00
larrybr
453954b0de Make a test conditioned on feature used.
FossilOrigin-Name: 31afda7ac3081d05fc9b6d080abeba1296327d0c480bbb4bc5f65c3168cd34ac
2021-04-16 21:29:07 +00:00
drh
188ba3a979 Add new dbsqlfuzz-generated cases to test/fuzzdata8.db.
FossilOrigin-Name: 1ac0a056a07895cc4ae62d01cbba5525402be3af3b8f97fd1dfaba2236ef912b
2021-04-16 19:25:47 +00:00
dan
11a6e9d9f0 Fix an assert() in fts3 that might fail when handing corrupt records.
FossilOrigin-Name: d0e2d6742f314f71562e404980aad20de6b17e0b04c08582c18bbc4fd0360751
2021-04-16 11:25:37 +00:00
dan
9988db8302 Fix a bad interaction between constant propagation and transitive term handling causing patterns like "WHERE unlikely(t1.x=t1.y) AND t1.y=?" to return non-matching rows.
FossilOrigin-Name: 2363a14ca723c0343fbe350f6c19787a7a47c2289fd9af136c97a451b53b5226
2021-04-15 19:09:19 +00:00
dan
37d4ec86bf Add extra test case for OOM handling in where.c.
FossilOrigin-Name: 7163de3dea0445bf25dba47a54c50f35bb5c7edc7bdae9630b51c1ca970ec6cf
2021-04-15 13:26:29 +00:00
dan
8505d73dc0 Fix a potential crash when using json_group_array() as a window function.
FossilOrigin-Name: 3c266690c753d093c2cb74138a46ed69276d85cd119d687a6858c84211e84eaf
2021-04-14 12:11:39 +00:00
dan
d487e37367 Fix a segfault that could occur if the ORDER BY clause of a compound SELECT contains a sub-select that uses one or more window functions.
FossilOrigin-Name: 5ba15ebb34c3af85ef6c54bbb3acb57176d629cda83774881b2a6467e138e904
2021-04-12 16:59:28 +00:00
dan
cd0b245934 Avoid an assert() failure when a compound scalar sub-select is, due to a "WHERE (sub-select) AND (... OR ...)" clause, coded twice by the code generator.
FossilOrigin-Name: a4e3f13329332f91a250bc18459fd4100990a1ac0516f8a0a6b21ff117db9795
2021-04-12 12:02:49 +00:00
dan
677e62aacd Fix a problem with handling expressions like "(col IS NULL AND <expr1>) OR col == NULL" in WHERE clauses.
FossilOrigin-Name: 40852ca8e215e51f63652a67817361b835b6fbbff7f66af50089af91007505f1
2021-04-10 14:49:45 +00:00
dan
bfd6f1bcd5 Fix a use-after-free error that could occur when processing "SELECT aggregate(DISTINCT <expr>)..." queries.
FossilOrigin-Name: 0e4789860b81c31d3a6d1f9f8340042ce1d08a82bf6119c783fcab85180b1b63
2021-04-08 20:29:12 +00:00
drh
4ad9673d00 Do not allow the use of rowid for views and subqueries unless compiled
with -DSQLITE_ALLOW_ROWID_IN_VIEW.

FossilOrigin-Name: a2ddb89b206c13876d34c5f9e3db41cda72d6eb3fea31ffa8cc6daa1e1580e16
2021-04-07 18:17:53 +00:00
drh
6e5020e8da Also prohibit the use of rowid from a subquery. Add the
SQLITE_ALLOW_ROWID_IN_VIEW compile-time option to restore legacy behavior
in case somebody actually needs it.

FossilOrigin-Name: 14b1d56ef84b0e62b7f9c4e5f7f985ca10e770c8db59f54004ad892c2a2dcbfb
2021-04-07 15:45:01 +00:00
dan
755ed41f5a Fix a possible crash that could occur when executing a drop column operation on a corrupt database schema.
FossilOrigin-Name: c337849416c588142a5066db3feb1716b7a9d02536bdb73cc9da7d162c0d5494
2021-04-07 12:02:30 +00:00