]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoUpdate the compile-time detection of architecture byte-order in the RTREE rtree-bulk-insert-perf
drh [Mon, 24 Apr 2023 19:14:56 +0000 (19:14 +0000)] 
Update the compile-time detection of architecture byte-order in the RTREE
extension so that it is aligned with the latest enhancements in the core.

FossilOrigin-Name: 491bd51da5e2069078d7295396d80d2ccdc3a5871714fef948076939174e6acd

2 years agoImport fixes from trunk into the branch-3.41.
drh [Sat, 22 Apr 2023 23:43:42 +0000 (23:43 +0000)] 
Import fixes from trunk into the branch-3.41.

FossilOrigin-Name: 58a1d94c59b8f16db2ceae79b4f3a70439edbdea20daac8fdefc85a51345a8b7

2 years agoFix a segfault that could occur if a non-empty in-memory database was the destination...
drh [Wed, 19 Apr 2023 17:13:26 +0000 (17:13 +0000)] 
Fix a segfault that could occur if a non-empty in-memory database was the destination of a backup operation from a database with a smaller page size.

FossilOrigin-Name: d37241585cf23b14695611a733fff4940db4c0501836e845dad17d2df0c8c22b

2 years agoDo not remove pages from the cache of an in-memory database due to a
drh [Wed, 19 Apr 2023 15:39:28 +0000 (15:39 +0000)] 
Do not remove pages from the cache of an in-memory database due to a
failure to acquire the page due to it being larger than the maximum page
size.

FossilOrigin-Name: 551b9dacd0e1c9edb028c8fc76904bf5c22e907ac4e5074b0df39a0de11e1227

2 years agoEnsure that the VACUUM command is not confused by alternative encodings when
drh [Tue, 18 Apr 2023 16:44:40 +0000 (16:44 +0000)] 
Ensure that the VACUUM command is not confused by alternative encodings when
it is the first command run on new database connection.

FossilOrigin-Name: 441f4e4a42796dc3fc9e16226cd2eb31d6575b10cdbba6e5283b11f3ecec2a65

2 years agoAnother fix to the indexed expressions in aggregate queries with GROUP BY
drh [Tue, 18 Apr 2023 14:17:59 +0000 (14:17 +0000)] 
Another fix to the indexed expressions in aggregate queries with GROUP BY
enhancement of ticket 99378177930f87bd and implemented by
check-in b9190d3da70c4171 to address a problem described by
forum post f34e32d120.

FossilOrigin-Name: c37e76104b4dd9ed87ffbcf6db374424122d2ebd63f0832a306c53a453c8cedc

2 years agoFix a typo in the aggfault.test test script.
drh [Fri, 14 Apr 2023 15:42:00 +0000 (15:42 +0000)] 
Fix a typo in the aggfault.test test script.

FossilOrigin-Name: e915bff7adf1475ab4fa982ed12240b3b834899ca82e64af1173054fddf6963b

2 years agoWhen setting the column types on a subquery, ensure that the COLFLAG_HASCOLL
drh [Fri, 14 Apr 2023 10:46:26 +0000 (10:46 +0000)] 
When setting the column types on a subquery, ensure that the COLFLAG_HASCOLL
flag is cleared from column names from when the collating sequence name has
been removed.

FossilOrigin-Name: de61bdc9b96d958c9651f5e8935ebbb0132fcae72de43fbf33d6c5c8e97906e3

2 years agoAvoid double de-quoting of table names when processing RESTRICT actions
drh [Fri, 14 Apr 2023 00:23:13 +0000 (00:23 +0000)] 
Avoid double de-quoting of table names when processing RESTRICT actions
in foreign key constraints.

FossilOrigin-Name: 5af7abffe7865375d9f5d1bede4d98bc5b26bd8c958398bda89a31f6a3f68524

2 years agoFix an obscure issue with ALTER TABLE RENAME that comes up with triggers
drh [Thu, 13 Apr 2023 18:49:58 +0000 (18:49 +0000)] 
Fix an obscure issue with ALTER TABLE RENAME that comes up with triggers
that have UPDATE statements that contain errors.

FossilOrigin-Name: cf651dee1279455dee5005701a2e8b76c9d2545b192919b84370d2e31a4a3baa

2 years agoRemove an ALWAYS() that can sometimes be false. And fix
drh [Thu, 13 Apr 2023 15:11:58 +0000 (15:11 +0000)] 
Remove an ALWAYS() that can sometimes be false.  And fix
a code-generator issue associated with very unusual use of window functions.

FossilOrigin-Name: fc12743763b2b5707ab101453c996bc18d514dcb6e9e0aaf6968618e9653a86d

2 years agoFix an assertion fault that can occur when compiling with both
drh [Sun, 9 Apr 2023 20:48:13 +0000 (20:48 +0000)] 
Fix an assertion fault that can occur when compiling with both
SQLITE_ENABLE_UNKNOWN_SQL_FUNCTIONS and SQLITE_ENABLE_STAT4.

FossilOrigin-Name: 2b02862de6046f032f079b8c8faf54454241077f232ccef0a0d80cf96d750560

2 years agoFix a faulty assert() in whereRangeScanEst() that should only apply if there
drh [Sun, 9 Apr 2023 10:23:01 +0000 (10:23 +0000)] 
Fix a faulty assert() in whereRangeScanEst() that should only apply if there
are not prior errors.

FossilOrigin-Name: 450d8ad85c510efa13753f23dcee5ae1b0ba872096b504ad7e08149d85ecfa67

2 years agoWork around a harmless assertion fault associated with
drh [Thu, 6 Apr 2023 17:41:57 +0000 (17:41 +0000)] 
Work around a harmless assertion fault associated with
sqlite3VdbeMemAboutToChange() such that the detection of stale values
in registers is preserved in debugging builds, but we avoid a false-positive
assertion fault in cases involving a virtual table with a LIMIT clause
in an IN-operator loop.

FossilOrigin-Name: 9511d17e2a113dac8933663fabb0294fdc1068fd4f8224818af21266439eb7ea

2 years agoA prepared statement that aborts due to SQLITE_SCHEMA should not invalidate
drh [Thu, 6 Apr 2023 15:32:57 +0000 (15:32 +0000)] 
A prepared statement that aborts due to SQLITE_SCHEMA should not invalidate
cursors in other prepared statements that are already running.

FossilOrigin-Name: 4eee8401c9ae151ad1baab0def607c5ceb60d3c018bf7ad8f7d547087df5e2f9

2 years agoIn the CLI, during error processing while looking for a word boundary,
drh [Thu, 6 Apr 2023 02:26:55 +0000 (02:26 +0000)] 
In the CLI, during error processing while looking for a word boundary,
avoid being deceived by malformed input that has a very long sequence
of 0x80 characters.
Also fix a problem in the zipfile extension for when a corrupt
zipfile has a zero-length filename.

FossilOrigin-Name: 5323ee77d7ac424021872b204feb5e3ad2a6b83f65a0bd0c1928a26227a6c99b

2 years agoRemove an ALWAYS() that can now be false due to the prior check-in.
drh [Wed, 5 Apr 2023 03:00:34 +0000 (03:00 +0000)] 
Remove an ALWAYS() that can now be false due to the prior check-in.

FossilOrigin-Name: 3bfdb4103d83365c32fb5497004948299399e403096cd3001e775b029a1cd8eb

2 years agoFix the function that determines the collating function for an expression
drh [Wed, 5 Apr 2023 02:25:37 +0000 (02:25 +0000)] 
Fix the function that determines the collating function for an expression
tree to handle new cases that arise as a result of the recently added
ability to use indexed expressions in aggregate queries.

FossilOrigin-Name: b29dea0dae3110f7d5d87be7f9096427227563229ed4fe2aef7fc86639856fe4

2 years agoFix an incorrect entry in the array that maps sqlite3_value values into
drh [Tue, 4 Apr 2023 18:59:38 +0000 (18:59 +0000)] 
Fix an incorrect entry in the array that maps sqlite3_value values into
actual datatype numbers.

FossilOrigin-Name: 80d518fb82ff8d837a35280460242ebb925c112024c29496d1804768a4c3efe8

2 years agoRemove an assert() statement that is no longer valid due to enhancements
drh [Tue, 4 Apr 2023 18:48:40 +0000 (18:48 +0000)] 
Remove an assert() statement that is no longer valid due to enhancements
to query planner for improved use of indexes.

FossilOrigin-Name: 93fb8c66c5703a8af4c87acb2a60f6b3ea13e1d11b31ddea3032348660508ee8

2 years agoWhen translating arguments of aggregate functions into references to
drh [Mon, 3 Apr 2023 23:55:20 +0000 (23:55 +0000)] 
When translating arguments of aggregate functions into references to
expression indexes, make sure to only translate them for the current
aggregate when there are nested aggregates.

FossilOrigin-Name: 7ea98aba78d10b26e1c8f67978a88a92aa2378dc50df9b5954bdd796affe4f9b

2 years agoWhen changing a COLLATE expression node into TK_AGG_COLUMN because the nodes
drh [Mon, 3 Apr 2023 18:00:53 +0000 (18:00 +0000)] 
When changing a COLLATE expression node into TK_AGG_COLUMN because the nodes
value is contained in an indexed expression, be sure to clear the
EP_Collate property from the expression node.

FossilOrigin-Name: af0f55cfcba0f53ee5641f20c5ef171f23f5eaea32d28e3a70899a2e2bf60dd6

2 years agoStronger constraint checking in allocateSpace().
drh [Mon, 3 Apr 2023 12:45:16 +0000 (12:45 +0000)] 
Stronger constraint checking in allocateSpace().

FossilOrigin-Name: 0f9e65b6c1e7f2f7a0358163c0ec3ce5fe8ed8814202b03ec167cf2f617f82f3

2 years agoEarlier detection of corruption in sqlite3BtreeDelete().
drh [Sun, 2 Apr 2023 18:49:45 +0000 (18:49 +0000)] 
Earlier detection of corruption in sqlite3BtreeDelete().
dbsqlfuzz a4c48c291d6e40157a1b749a05eaa7c7faf5a625.

FossilOrigin-Name: 728633c0bd665ed94e4969180a83ef102c54371e339bc06ea6cb006eaefdb267

2 years agoOmit the the count-of-view optimization if there is a HAVING clause.
drh [Fri, 31 Mar 2023 23:59:31 +0000 (23:59 +0000)] 
Omit the the count-of-view optimization if there is a HAVING clause.

FossilOrigin-Name: a8faea2842f412dfa2588b65868acb523c9eae1b5ad15c631a1ab193eaa615a7

2 years agoEarlier error detection for index expression usage by aggregate functions.
drh [Thu, 30 Mar 2023 19:14:36 +0000 (19:14 +0000)] 
Earlier error detection for index expression usage by aggregate functions.
dbsqlfuzz 29214ace4e25c98d2ddff8fbcf97afdda23f28b9

FossilOrigin-Name: cf8dd8cd0857f402afa43feb1b71a88f7429df89448e2321cad3777484d0c438

2 years agoCherrypick three fixes from trunk.
drh [Thu, 30 Mar 2023 11:28:38 +0000 (11:28 +0000)] 
Cherrypick three fixes from trunk.

FossilOrigin-Name: 5583ea82c6e4555081a7b9ee3c397663abbcdd626e2d1e964aeb31e6d4d4bc4c

2 years agoEnhance PRAGMA integrity_check so that it can detect that a NOT NULL column
drh [Wed, 29 Mar 2023 11:40:56 +0000 (11:40 +0000)] 
Enhance PRAGMA integrity_check so that it can detect that a NOT NULL column
contains a NaN value and report that as an error.

FossilOrigin-Name: fbc27e18aac7e403c5888c031a57748eebcd31f47c639281c2febe3a64fc529b

2 years agoFix a weird corner case in aggregate function processing that results from the
drh [Tue, 28 Mar 2023 16:13:55 +0000 (16:13 +0000)] 
Fix a weird corner case in aggregate function processing that results from the
recent addition of support for index expressions on aggregate queries.

FossilOrigin-Name: 36fd948e34c5f1bb1c49957ea349ac521c97a7298f4f9d61a683e03d20818651

2 years agoFix multiple problems with RETURNING on a DML statement against a view.
drh [Tue, 28 Mar 2023 11:21:09 +0000 (11:21 +0000)] 
Fix multiple problems with RETURNING on a DML statement against a view.
(1) Do not allow a RETURNING clause to trick the code generator into thinking
that the view being updated has an INSTEAD OF trigger.
(2) Generate all result columns for a view in a DML statement.
(3) The automatic covering index for a view should cover all result columns
of the view.

FossilOrigin-Name: b49816fcce24d28ac2147a3b9afdc8b5b95ed68f89c74b0e6afb1ad5b9bd8741

2 years agoDo not allow constant factoring during PRAGMA integrity_check, since the
drh [Mon, 27 Mar 2023 13:27:25 +0000 (13:27 +0000)] 
Do not allow constant factoring during PRAGMA integrity_check, since the
constants might be stored in registers that are later reused for other
purposes.

FossilOrigin-Name: a4b5f499d9429ca219c1a706b4767e528a2baf7ddb45bde9d01a4ce5f15cbb0f

2 years agoImprovements to register allocation, especially in the ANALYZE command.
drh [Mon, 27 Mar 2023 13:10:43 +0000 (13:10 +0000)] 
Improvements to register allocation, especially in the ANALYZE command.
New assert() statements added to help verify that memory allocation is
correct, and to help fuzzer find lingering errors.

FossilOrigin-Name: 636f6fad8d4cf7238ed2281d6c3c29736663935ff58709a783a50bc0289d40f4

2 years agoWhen the left table of a RIGHT JOIN is used inside an aggregate function and the...
drh [Sat, 25 Mar 2023 23:56:15 +0000 (23:56 +0000)] 
When the left table of a RIGHT JOIN is used inside an aggregate function and the left table employs an index on expressions, then make sure the expressions evaluate to NULL for the cases where the left table should be NULL.

FossilOrigin-Name: c51df77ebe5046fdcbd6b45990ba0eb295486a4ce12a1d47d0cacc8ec3310024

2 years agoWhen reading sqlite_stat4 data during query planning, be sure to expand
drh [Sat, 25 Mar 2023 22:42:01 +0000 (22:42 +0000)] 
When reading sqlite_stat4 data during query planning, be sure to expand
zeroblobs prior to running comparisons.

FossilOrigin-Name: 60f4d19d91ac29f5c84eaab77d5a92b2005a05ef89c8855dd800a1c457eafb16

2 years agoIn the byte-code generator, when the result of an expression needs to be in a particular
drh [Sat, 25 Mar 2023 19:46:21 +0000 (19:46 +0000)] 
In the byte-code generator, when the result of an expression needs to be in a particular
register, always use the sqlite3ExprCode() routine because it has the smarts
to know whether to use OP_Copy or OP_SCopy.  Do not try to OP_SCopy inline
because an OP_Copy might be required.

FossilOrigin-Name: 2d439ccca4f8fd2bcf2178b4ebea54d6a6434303eeb0fe3c6b0be4f2ea5cbb60

2 years agoThe fix at [13c8c60bb6b4447b] was incomplete in that it failed to clear
drh [Sat, 25 Mar 2023 18:33:42 +0000 (18:33 +0000)] 
The fix at [13c8c60bb6b4447b] was incomplete in that it failed to clear
the reusable register cache that might contain registers in the STAT4
buffer region.  This additional change corrects the problem.

FossilOrigin-Name: 671bf6f5320bb3add6c897b2c3c78db504d3f0a21ba5347247bc9073ef669f55

2 years agoFix a problem in cursor-hints for WITHOUT ROWID tables.
drh [Sat, 25 Mar 2023 02:02:10 +0000 (02:02 +0000)] 
Fix a problem in cursor-hints for WITHOUT ROWID tables.

FossilOrigin-Name: fc8ec188d943245ce10595aecf4095d3077f5fbafdeef7de8183afe9ad26eaf7

2 years agoFix CLI non-handling of OOM.
drh [Sat, 25 Mar 2023 01:50:07 +0000 (01:50 +0000)] 
Fix CLI non-handling of OOM.

FossilOrigin-Name: 44c76f001af0d4e48b3e3a8d6a5bc1dedec5afee82d4d3a37562a330a79cc052

2 years agoRemove undocumented, vestigial SQL functions in the CLI that were once used
drh [Fri, 24 Mar 2023 22:24:08 +0000 (22:24 +0000)] 
Remove undocumented, vestigial SQL functions in the CLI that were once used
for the ".recover" command but are now no longer needed.  This is a fix for
the problem described by [forum:/forumpost/be9c294ee0|forum post be9c294ee0].

FossilOrigin-Name: 74d14900afd10d0284981f648047e781c7a468bc6b292aa3bb6678fbd19fbd4d

2 years agoFix an error in the OP_SeekScan opcode.
drh [Fri, 24 Mar 2023 21:27:37 +0000 (21:27 +0000)] 
Fix an error in the OP_SeekScan opcode.

FossilOrigin-Name: b95e69330eca0f4561a5a448c43643a83329db1daa48b568b69d0fdb55bbc9ec

2 years agoIncrease the version number to 3.41.3.
drh [Fri, 24 Mar 2023 20:41:33 +0000 (20:41 +0000)] 
Increase the version number to 3.41.3.

FossilOrigin-Name: 9a19c6ce80a73f9b11bbd9e5e82f31fec6df91caa900bf67d201087443fe876d

2 years agoFix the handling of indexed expressions in an outer query that appear as
drh [Fri, 24 Mar 2023 20:39:13 +0000 (20:39 +0000)] 
Fix the handling of indexed expressions in an outer query that appear as
corelated values inside an aggregate function within a subquery.

FossilOrigin-Name: 76b90f267c5cc676d9ba97caa0f664e75af8b21c8eb574ec0c1f11e4deedb49e

2 years agoFix byte-code register allocation in ANALYZE for STAT4 when there multiple
drh [Fri, 24 Mar 2023 17:01:29 +0000 (17:01 +0000)] 
Fix byte-code register allocation in ANALYZE for STAT4 when there multiple
indexes with differing numbers of columns.

FossilOrigin-Name: 13c8c60bb6b4447b52895dd63a4dffafa23b0aa05f37ce8d78896b638b385db6

2 years agoThe attempt to bring STAT4 up to 100% MC/DC at [55a26c67ed4a3a93] and
drh [Thu, 23 Mar 2023 10:58:19 +0000 (10:58 +0000)] 
The attempt to bring STAT4 up to 100% MC/DC at [55a26c67ed4a3a93] and
at [168fa2fb22b8c1ad] are incorrect.  Back them out and replace them with
a simple NEVER() macro.  Error reported by
[forum:/forumpost/dc4854437b|forum post dc4854437b].

FossilOrigin-Name: 76e683c5f25fe0471215e833a6f4f6e50890bbdd1ca639035754e9a2831dd406

2 years agoVersion 3.41.2 version-3.41.2
drh [Wed, 22 Mar 2023 11:56:21 +0000 (11:56 +0000)] 
Version 3.41.2

FossilOrigin-Name: 0d1fc92f94cb6b76bffe3ec34d69cffde2924203304e8ffc4155597af0c191da

2 years agoIncrement the version number in the TEA configure script to 3.41.2.
drh [Wed, 22 Mar 2023 11:12:28 +0000 (11:12 +0000)] 
Increment the version number in the TEA configure script to 3.41.2.

FossilOrigin-Name: 2bb74aa501b7245f4e4d789630fe8c5265c7644ce223404fe7360d5a1fe8cd76

2 years agoFix a valgrind error and potential buffer overread when handling a corrupt database.
drh [Tue, 21 Mar 2023 11:27:41 +0000 (11:27 +0000)] 
Fix a valgrind error and potential buffer overread when handling a corrupt database.

FossilOrigin-Name: cb8b34fa1aa8bbe756ad9cfd864f93f8b5a78948b2622aaa230d4db18b846a4f

2 years agoFix a problem causing a cursor to retain an out-of-date cell-info cache when processi...
drh [Mon, 20 Mar 2023 15:50:40 +0000 (15:50 +0000)] 
Fix a problem causing a cursor to retain an out-of-date cell-info cache when processing a DISTINCT query on values that are identical according to their collation sequence, but different on disk.

FossilOrigin-Name: b02811847cbb9c80ba886d3e84fc6a8048cde5c932405f50416baf6e0cbd78e9

2 years agoFix problems with the sqlite3_error_offset() function and its use in the CLI.
drh [Mon, 20 Mar 2023 01:59:58 +0000 (01:59 +0000)] 
Fix problems with the sqlite3_error_offset() function and its use in the CLI.

FossilOrigin-Name: d5cd6c885b71b0939f5832fbb63bf800ae03dbbc2dc0f7beab1270133d414c54

2 years agoIncrease the size of ref-count values in the pager layer to 64-bits, to avoid
drh [Sun, 19 Mar 2023 21:53:35 +0000 (21:53 +0000)] 
Increase the size of ref-count values in the pager layer to 64-bits, to avoid
any reasonable possiblity of overflowing the counters.

FossilOrigin-Name: 824611ad33011bda676ce6c9c3cb2b46442fc0a48c458bdc86dd960623c1e945

2 years agoAvoid a buffer overread in fts3 that could occur when processing a corrupt record.
drh [Sun, 19 Mar 2023 10:30:02 +0000 (10:30 +0000)] 
Avoid a buffer overread in fts3 that could occur when processing a corrupt record.

FossilOrigin-Name: 1f91fe4bfc81bf66f9c8f0aebe0acdbac89e2c20d90a5eb4ea0a3c560b82a9cd

2 years agoFix a potential buffer overread in the recovery extension.
dan [Fri, 17 Mar 2023 14:22:45 +0000 (14:22 +0000)] 
Fix a potential buffer overread in the recovery extension.

FossilOrigin-Name: 78836713c965066cb9c1cc732a9cecb1d74a25f37775a01c088393881e4fd8d6

2 years agoEnsure that an error does not delete the Table object out from under
drh [Fri, 17 Mar 2023 12:25:10 +0000 (12:25 +0000)] 
Ensure that an error does not delete the Table object out from under
the xConstruct method of a virtual table.
dbsqlfuzz 7cc8804a1c6d4e3d554d79096e6ea75a7c1c7d2d

FossilOrigin-Name: c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba

2 years agoIncrease the version number to 3.41.2
drh [Fri, 17 Mar 2023 10:30:05 +0000 (10:30 +0000)] 
Increase the version number to 3.41.2

FossilOrigin-Name: 122f12f5363245a4566dc15ce81ecac5fce70ce9aa478408483f88bd86a8e6bc

2 years agoFix assert() statements that would (incorrectly) fire if an IF NOT EXISTS
drh [Fri, 17 Mar 2023 00:10:06 +0000 (00:10 +0000)] 
Fix assert() statements that would (incorrectly) fire if an IF NOT EXISTS
trigger that already exists contained two or more RETURNING clauses.

FossilOrigin-Name: 9b43b34d81adb1a8fd5e087f6c61387ed3a2e3e604418e295906d220f5cc5254

2 years agoCorrectly handle SELECT DISTINCT ... ORDER BY when all of the result set terms
drh [Thu, 16 Mar 2023 21:05:59 +0000 (21:05 +0000)] 
Correctly handle SELECT DISTINCT ... ORDER BY when all of the result set terms
are constant and there are more result set terms than ORDER BY terms.

FossilOrigin-Name: 097512b60498803570fe80d0403963ed2b5cecbee7156af355418ff9f1851d60

2 years agoDo not use the one-pass optimization on an UPDATE if there is a subquery
drh [Thu, 16 Mar 2023 10:21:52 +0000 (10:21 +0000)] 
Do not use the one-pass optimization on an UPDATE if there is a subquery
in the WHERE clause, since if the subquery is hidden behind a short-circuit
operator, the subquery might not be evaluated until after one or more rows
have been updated.

FossilOrigin-Name: b5d8a9a6a58b4eb81a663192f578e0fbed72e8155bc7e1100ece04e8394a1984

2 years agoRemove a NEVER() from btreeNext().
drh [Thu, 16 Mar 2023 09:16:31 +0000 (09:16 +0000)] 
Remove a NEVER() from btreeNext().

FossilOrigin-Name: 40623f5ab07481179f1efd5d377555c8d78bf0706a16212c0f6b954c17736a5c

2 years agoFix a broken assert() in the recovery extension.
drh [Thu, 16 Mar 2023 09:12:09 +0000 (09:12 +0000)] 
Fix a broken assert() in the recovery extension.

FossilOrigin-Name: 048711e49002e59cbaf51079403a3f37abaa7d3a04e0cb20de4aed2d56c0e837

2 years agoDisallow the one-pass optimization for DELETE if the WHERE clause contains
drh [Wed, 15 Mar 2023 18:05:02 +0000 (18:05 +0000)] 
Disallow the one-pass optimization for DELETE if the WHERE clause contains
a subquery.

FossilOrigin-Name: 25e1831885e8de370482a1e9f664f1590fa49995048fb16e1f948acd2a29c3e3

2 years agoFix Bloom filters on an expression index.
drh [Tue, 14 Mar 2023 20:16:48 +0000 (20:16 +0000)] 
Fix Bloom filters on an expression index.

FossilOrigin-Name: 11e0256b8c6f29bd2e60a0820f740e9927112bf6a0814751b7a73896298b4826

2 years agoThe cherry-pick merge at [371838562a675c1b] caused a performance regression
drh [Sat, 11 Mar 2023 23:29:34 +0000 (23:29 +0000)] 
The cherry-pick merge at [371838562a675c1b] caused a performance regression
for some queries, which is here fixed.

FossilOrigin-Name: 6d6d95fcedbc8758ab284d3014ae4a97af6247003bb3d0a7056f2e6bffa6cae4

2 years agoVersion 3.41.1 version-3.41.1
drh [Fri, 10 Mar 2023 12:13:52 +0000 (12:13 +0000)] 
Version 3.41.1

FossilOrigin-Name: 20399f3eda5ec249d147ba9e48da6e87f969d7966a9a896764ca437ff7e737ff

2 years agoIn the Bloom filter optimization, hash all strings and blobs into the same
drh [Thu, 9 Mar 2023 16:04:34 +0000 (16:04 +0000)] 
In the Bloom filter optimization, hash all strings and blobs into the same
value, because we do not know if two different strings might compare equal
even if they have different byte sequences, due to collating functions.
Formerly, the hash of a string or blob was just its length.  This could
all be improved.

FossilOrigin-Name: cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730

2 years agoFix countofview.test so that it works with SQLITE_OMIT_PROGRESS_CALLBACK builds.
dan [Thu, 9 Mar 2023 15:08:56 +0000 (15:08 +0000)] 
Fix countofview.test so that it works with SQLITE_OMIT_PROGRESS_CALLBACK builds.

FossilOrigin-Name: d55a7742c9447eba20a7fe252fb3edcabba3793030a55976d5a5e6c65bce7706

2 years agoUpdate the version number to 3.41.1
drh [Thu, 9 Mar 2023 14:14:18 +0000 (14:14 +0000)] 
Update the version number to 3.41.1

FossilOrigin-Name: e4e2e64725a196ee4f287649db33f49fd7329c95cef3ce743cd177c998a6a343

2 years agoMerge count-of-view optimization fixes from trunk. But count-of-view is
drh [Thu, 9 Mar 2023 13:58:49 +0000 (13:58 +0000)] 
Merge count-of-view optimization fixes from trunk.  But count-of-view is
still off by default for this branch.

FossilOrigin-Name: cbbe8986ea26e78a7c5b122170cb5bf3f275f8e3a2941017f9ef11d7f3864256

2 years agoFix a possible NULL pointer dereference due to the sqlite3_interrupt()
drh [Thu, 9 Mar 2023 01:35:52 +0000 (01:35 +0000)] 
Fix a possible NULL pointer dereference due to the sqlite3_interrupt()
enhancement in the 3.41.0 release.

FossilOrigin-Name: 66d24a220e3455a183b61490f42869520744cb3990e13f3ded92f1b6a7e248ce

2 years agoKeep the historical datatype ("INT", not "NUM") for a table created as follows: ...
drh [Wed, 8 Mar 2023 14:37:04 +0000 (14:37 +0000)] 
Keep the historical datatype ("INT", not "NUM") for a table created as follows: "CREATE TABLE t1 AS SELECT CAST(123 AS INT) AS value;".  The use of FLEXNUM only occurs on compound queries.

FossilOrigin-Name: dc1033af4bf707095032f66d7a8ab63204f38bae244fab16a2bc870840d5bffd

2 years agoFix an assertion fault added by [65ffee234787213c].
drh [Wed, 8 Mar 2023 00:04:47 +0000 (00:04 +0000)] 
Fix an assertion fault added by [65ffee234787213c].

FossilOrigin-Name: d00e68baf73238d2f91df6b19525c91539a7fe26406516cbacfff113e79e26ea

2 years agoCherry-pick the agg-with-indexed-expr optimization fix from trunk.
drh [Sat, 4 Mar 2023 15:49:33 +0000 (15:49 +0000)] 
Cherry-pick the agg-with-indexed-expr optimization fix from trunk.

FossilOrigin-Name: b2ad89d3f0fe5c7582d97e65770eb93986ba8d4b031aafb04f86160383b47aab

2 years agoDo not use an expression index on a generated column if generated column has the...
drh [Fri, 3 Mar 2023 19:47:09 +0000 (19:47 +0000)] 
Do not use an expression index on a generated column if generated column has the wrong affinity.

FossilOrigin-Name: 65ffee234787213ca3b12afde1b5ed7ae536366c30e984b14c0975da0c57917d

2 years agoEnhance PRAGMA integrity_check so that it can detect when there are extra
drh [Fri, 3 Mar 2023 18:47:29 +0000 (18:47 +0000)] 
Enhance PRAGMA integrity_check so that it can detect when there are extra
bytes at the end of an index record, which might cause OP_IdxRowid to
malfunction.

FossilOrigin-Name: c143f08713ec5dcc7609804f1fa0d795005c7ebd265b73e42342584d759eae01

2 years agoWhen it is known when preparing a statement that X cannot be NULL, transform the...
drh [Fri, 3 Mar 2023 17:11:15 +0000 (17:11 +0000)] 
When it is known when preparing a statement that X cannot be NULL, transform the expression (X IS NULL) to integer value 1 instead of 'true'. This is because under some circumstances, "Y IS TRUE" may not be equivalent to "Y IS 1".

FossilOrigin-Name: 0fc7f7c2a90ce9bc3462478441b4e628c90e5adff0d461e6cc3521371b7f1f08

2 years agoWhen flattening the right operand of a LEFT JOIN,
drh [Thu, 2 Mar 2023 14:09:11 +0000 (14:09 +0000)] 
When flattening the right operand of a LEFT JOIN,
ensure that the OP_IfNullRow opcode does not
NULL-out a subquery result that was computed within OP_Once.

FossilOrigin-Name: c80b262c9dbde80c51872f36f9c4d406eba1c3f34468d36d5cb7084b1720ee5c

2 years agoWhen flattening a view that is the right operand of a LEFT JOIN
drh [Wed, 1 Mar 2023 20:44:34 +0000 (20:44 +0000)] 
When flattening a view that is the right operand of a LEFT JOIN
always insert the TK_IF_NULL_ROW expression nodes, even for TK_COLUMN
expressions, as the TK_COLUMN might be a column from an outer query
and hence still need to be NULLed out.

FossilOrigin-Name: 371838562a675c1bdd9c80250230eb87ac0e5e135cc39abbdbe1f8b1b8149445

2 years agoMake sure subtypes do not cross a subquery
drh [Wed, 1 Mar 2023 15:28:34 +0000 (15:28 +0000)] 
Make sure subtypes do not cross a subquery
boundary even if the function that returned the value with a subtype is
buried down inside a larger expression.

FossilOrigin-Name: 9dc460318d98308f51e31df216872ff96ece67c86f50c3fd11bf2a3df112afdd

2 years agoWhen a table-valued function appears as the right table of a RIGHT JOIN,
drh [Sun, 26 Feb 2023 21:09:45 +0000 (21:09 +0000)] 
When a table-valued function appears as the right table of a RIGHT JOIN,
the argument constraints on the table-valued function should be considered
part of the ON clause of the RIGHT JOIN.

FossilOrigin-Name: d225d077c4fcc526e70d59018479bba723d464cac5ac805eeeebd7d2a48cedcf

2 years agoProvide -DHAVE_LOG2=0 and -DHAVE_LOG10=0 compile-time options for use on systems
drh [Thu, 23 Feb 2023 17:12:07 +0000 (17:12 +0000)] 
Provide -DHAVE_LOG2=0 and -DHAVE_LOG10=0 compile-time options for use on systems
that lack the log2() and log10() standard math library routines, to cause
SQLite to substitute its own alternatives.

FossilOrigin-Name: ff3362ab53752de10bd95a16804ce3ef31edd8f0cb3099841c3e4ffc1d79d64d

2 years agoVersion 3.41.0 version-3.41.0
drh [Tue, 21 Feb 2023 18:09:37 +0000 (18:09 +0000)] 
Version 3.41.0

FossilOrigin-Name: 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d

2 years agoDisable DQS by default in the MSVC makefile for the amalgamation tarball.
drh [Tue, 21 Feb 2023 13:28:49 +0000 (13:28 +0000)] 
Disable DQS by default in the MSVC makefile for the amalgamation tarball.

FossilOrigin-Name: 409a19145e9558686acab730b94c6d53691b6d0efcea1e9239fc7e5863586a85

2 years agoYet another comment typo fix. No changes to working code.
drh [Tue, 21 Feb 2023 12:42:25 +0000 (12:42 +0000)] 
Yet another comment typo fix.  No changes to working code.

FossilOrigin-Name: cdbdc8013fcfa8ce1bd4f5521c8d98afc53b9c577d43e5e6d0d1e15c789b910f

2 years agoFix a minor typo in a comment. No changes to working code.
drh [Tue, 21 Feb 2023 12:34:00 +0000 (12:34 +0000)] 
Fix a minor typo in a comment.  No changes to working code.

FossilOrigin-Name: 7981671d1449b3fc6eb214deb558d91b87dc4fa6e38e24606625a146cc71664a

2 years agoFix formatting and improved documentation on the various sqlite3_file_control()
drh [Tue, 21 Feb 2023 12:30:18 +0000 (12:30 +0000)] 
Fix formatting and improved documentation on the various sqlite3_file_control()
opcodes.  Other minor documentation changes.  No changes to working code.

FossilOrigin-Name: 13280f720a4ef5a1f7f2a2fbe72f374d3a2e12be9bc0c50f7fce50d0cd28a67f

2 years agoUpdate the TEA version number to 3.41.0
drh [Mon, 20 Feb 2023 19:43:01 +0000 (19:43 +0000)] 
Update the TEA version number to 3.41.0

FossilOrigin-Name: b450a920c0c59affd105616e999205cb9d2b25a79f8a7f7f05610ddaac0f770f

2 years agoFix an incorrect #ifdef in the CLI.
drh [Mon, 20 Feb 2023 16:55:58 +0000 (16:55 +0000)] 
Fix an incorrect #ifdef in the CLI.

FossilOrigin-Name: 3c4d29cf227511bf218ef620d497dc72c708dcc819971b34c7629f3ed11803fb

2 years agoFix a harmless compiler warning.
drh [Sun, 19 Feb 2023 19:16:51 +0000 (19:16 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: b2534d8de5051a3516f4b9ee5a4b99e1dcf455e9af88c60815d2c2a479fc8566

2 years agoFix stale requirement marks and fix a typo in the documentation for
drh [Sat, 18 Feb 2023 20:31:26 +0000 (20:31 +0000)] 
Fix stale requirement marks and fix a typo in the documentation for
sqlite3_preupdate_hook().

FossilOrigin-Name: 655991f5d9afdd3281049eb430921046e0ba90eef215020c2fb149adc0d3c4c5

2 years agoFix a harmless UBSAN warning in debugging code of the new unhex() function.
drh [Sat, 18 Feb 2023 15:50:23 +0000 (15:50 +0000)] 
Fix a harmless UBSAN warning in debugging code of the new unhex() function.

FossilOrigin-Name: 315574d5cbe5c805ff2163052d986b054985984fb45bfb064d1a7b39a22b90eb

2 years agoFix a harmless typo in the test case added by [29fc06465efb948f].
drh [Fri, 17 Feb 2023 22:48:46 +0000 (22:48 +0000)] 
Fix a harmless typo in the test case added by [29fc06465efb948f].

FossilOrigin-Name: e0a0bf56f11f32f58705098e76c276deaf90cfa87e110032bdaad10ce9674f61

2 years agoDo not allow the COUNTOFVIEW optimization to run if the count() contains
drh [Fri, 17 Feb 2023 18:27:48 +0000 (18:27 +0000)] 
Do not allow the COUNTOFVIEW optimization to run if the count() contains
a FILTER clause.  dbsqlfuzz 4f8e0de6e272bbbb3e1b41cb5aea31e0b47297e3

FossilOrigin-Name: 29fc06465efb948f98d2733bb25ffa1e0662a0189304006b3d0be9fec7dd28c5

2 years agoUpdate testrunner.tcl to run zipvfs test scripts on unix.
dan [Tue, 14 Feb 2023 18:09:40 +0000 (18:09 +0000)] 
Update testrunner.tcl to run zipvfs test scripts on unix.

FossilOrigin-Name: e6c8e19ab0d6e7526d4596b75a45bb6becaf3c029690f7e75c016eac803c9990

2 years agoIgnore extra parentheses around a subquery on the RHS of an IN operator,
drh [Mon, 13 Feb 2023 19:32:40 +0000 (19:32 +0000)] 
Ignore extra parentheses around a subquery on the RHS of an IN operator,
because that is what PostgreSQL does.

FossilOrigin-Name: ecdeef43b27412b0b0b09e09a62ad3a03836a3fc80f2070268090e7ca8f02712

2 years agoDo not allow WHERE clause terms to match constant string index terms, which
drh [Mon, 13 Feb 2023 18:42:01 +0000 (18:42 +0000)] 
Do not allow WHERE clause terms to match constant string index terms, which
can happen if DQS_DDL is enabled.  Follow-up to
[44200596aa943963].  dbsqlfuzz 54c9db85ed4af7055f5fd0d50877875c82b11d46.

FossilOrigin-Name: 2d2b91cc0f6fed8cb6f738dc7019047ce0f1e86b5eb8efa997095d08a32cbcb6

2 years agoAllow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.
dan [Mon, 13 Feb 2023 18:37:48 +0000 (18:37 +0000)] 
Allow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.

FossilOrigin-Name: 18a99d9cfbc3a0419342b3fe91a83d2217578d0f6e8ee1084237d000946b1942

2 years agoFix compile time option SQLITE_DEFAULT_SYNCHRONOUS so that it works consistently.
dan [Mon, 13 Feb 2023 18:26:58 +0000 (18:26 +0000)] 
Fix compile time option SQLITE_DEFAULT_SYNCHRONOUS so that it works consistently.

FossilOrigin-Name: bf6f1ee77c4bf653f6cd2a3db5292b8c5c83f18ea9acf951107d22807546b28a

2 years agoAllow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.
dan [Mon, 13 Feb 2023 16:10:31 +0000 (16:10 +0000)] 
Allow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.

FossilOrigin-Name: 1815b15ddb8785a25b7617aab19e13c2410b9377389c16a85176025b3d9400e8

2 years agoIn the LIKE optimization, do not analyze the new virtual WHERE clause terms
drh [Mon, 13 Feb 2023 12:46:22 +0000 (12:46 +0000)] 
In the LIKE optimization, do not analyze the new virtual WHERE clause terms
until both have been added, since they are expected to be consecutive and
the analysis might add complementary terms.
This fixes a problem caused by [44200596aa943963] and discovered by dbsqlfuzz
and recorded as case 7e3b5983727d843b910b2d9ab556e4afcd777cfb.

FossilOrigin-Name: d35de3ad3fac6b30d3f266cbe4b1e9923eb31a1eff4a869205bbc3ba122eeec5

2 years agoChange a variable from 32 to 64-bits to avoid a harmless compiler warning
drh [Sat, 11 Feb 2023 21:11:39 +0000 (21:11 +0000)] 
Change a variable from 32 to 64-bits to avoid a harmless compiler warning
in Xcode.  [forum:/forumpost/402d733c22|Forum post 402d733c22].

FossilOrigin-Name: 0216ce23cf23bc147c5de6de178a6689b7ad744bf0ee0098809938b5fe10708b

2 years agoDo a better job of detecting when a WHERE clause term might be useful to
drh [Fri, 10 Feb 2023 21:53:33 +0000 (21:53 +0000)] 
Do a better job of detecting when a WHERE clause term might be useful to
an expression index.  Fix for performance regression reported by
[forum:/forumpost/e65800d8cb|forum thread e65800d8cb].

FossilOrigin-Name: 44200596aa943963bc6ca98b5d4fd5b9235d1109d8dfc1a75eeae353b4239142