]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
23 months agoChange an assert() (incorrectly) added by the previous check-in into a star-schema
drh [Wed, 29 May 2024 14:32:22 +0000 (14:32 +0000)] 
Change an assert() (incorrectly) added by the previous check-in into a
testcase().

FossilOrigin-Name: 5e64b541d175c10a5df67ef3419ecd74fcb51392af5f5458973cea85ee6a3246

23 months agoSmall performance enhancement in wherePathSolver()
drh [Wed, 29 May 2024 14:04:52 +0000 (14:04 +0000)] 
Small performance enhancement in wherePathSolver()

FossilOrigin-Name: bdab69641df4704f7b080cf7841bbf39da9160222f7b664a79ed662b70ca7b0a

23 months agoImprovements to comments and debugging output.
drh [Wed, 29 May 2024 13:29:39 +0000 (13:29 +0000)] 
Improvements to comments and debugging output.

FossilOrigin-Name: 85164ee155e42809fe34e6c6b6fbe0a2baa9d616326a811173a0b0c8a885fcce

23 months agoRemember the amount of the heuristic cost adjustment associated with
drh [Wed, 29 May 2024 10:40:53 +0000 (10:40 +0000)] 
Remember the amount of the heuristic cost adjustment associated with
star schemas and compensate when computing whether or not to use Bloom
filters.

FossilOrigin-Name: 21daf2463ef70e6b5dc73ba5bf62b3d2fb504e9189f645ac74b513d3d8b979c2

23 months agoFix typos in the star-schema test cases.
drh [Wed, 29 May 2024 09:53:19 +0000 (09:53 +0000)] 
Fix typos in the star-schema test cases.

FossilOrigin-Name: 4080937353985eb391f70a3a7fae890823cf01d19c52939e343fb2504f3f8659

23 months agoUse a heuristic in the query planner to help it better cope with large
drh [Wed, 29 May 2024 00:38:12 +0000 (00:38 +0000)] 
Use a heuristic in the query planner to help it better cope with large
star schema queries.

FossilOrigin-Name: a98be0f548f277fab8f38a2dec6ddcbe7a7fff27856ba19e76ad8c5641894b7b

23 months agoFix a couple of assert() statements so that they cannot fire
drh [Tue, 28 May 2024 19:08:18 +0000 (19:08 +0000)] 
Fix a couple of assert() statements so that they cannot fire
when the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS debugging capability
is activated.  dbsqlfuzz f5b347cf167a62fbe08062b2feee65cb9306e363.

FossilOrigin-Name: 273504b74cb9c3cfa2497a1339e706a1f2d2c3ce81b23a16beb47da9292535e0

23 months agoTweaks to the query planner so that it is better able to deal with star
drh [Tue, 28 May 2024 18:53:36 +0000 (18:53 +0000)] 
Tweaks to the query planner so that it is better able to deal with star
queries with many dimensions and bad indexes.

FossilOrigin-Name: 1e49081001f93b75ee499536f8a61a0f49225a1745117bb9267249c38c4bf803

23 months agoIncrease the number of parallel paths in the query solver from 12 to 20.
drh [Tue, 28 May 2024 12:41:11 +0000 (12:41 +0000)] 
Increase the number of parallel paths in the query solver from 12 to 20.
In the .wheretrace output, sort the parallel paths in order of increasing
cost.

FossilOrigin-Name: 8ba2c2f5cb31f7bcc426bec78457316ef11d0b5debf24e8da8c6fc2f95878b1e

23 months agoDocumentation typo fix. [forum:/forumpost/772d6688f5|Forum post 772d6688f5].
drh [Tue, 28 May 2024 11:24:18 +0000 (11:24 +0000)] 
Documentation typo fix. [forum:/forumpost/772d6688f5|Forum post 772d6688f5].

FossilOrigin-Name: 1f2f9c709eaee3c45664afa062f0fb2b912de446581066c87ea144b8ba55b55c

23 months agoFix a problem with the error message reported by fts5 in some OOM cases.
dan [Tue, 28 May 2024 10:57:24 +0000 (10:57 +0000)] 
Fix a problem with the error message reported by fts5 in some OOM cases.

FossilOrigin-Name: c7aaa28f786567e29ebee3848283b5c740dd3b8144dc14372e56260ae1b76922

23 months agoImprove the automatic-index decision such that no attempt is made to create
drh [Tue, 28 May 2024 00:16:52 +0000 (00:16 +0000)] 
Improve the automatic-index decision such that no attempt is made to create
an automatic index on a column that is known to be non-selective because if
its use in other indexes that have been analyzed.  See
[src:/tktview/8ff324e120|ticket 8ff324e120] and
[forum:/forumpost/b21c2101a559be0a|forum post b21c2101a559be0a].

FossilOrigin-Name: 2a7603c327d11d5e6bc4d40c29151fea544d650f51200ff76efb921adb0c38df

23 months agoQuery planner tuning: Increase the maximum number of simultaneous solutions
drh [Tue, 28 May 2024 00:01:07 +0000 (00:01 +0000)] 
Query planner tuning:  Increase the maximum number of simultaneous solutions
to track int eh solver from 10 to 12.

FossilOrigin-Name: fe2e1dadbacbe6392ceed44fd287a2ed82189cb8055f35631d37967d9a7a5d1d

23 months agoAvoid creating an automatic index on a column that is known to be not very auto-index-improvements
drh [Mon, 27 May 2024 21:55:01 +0000 (21:55 +0000)] 
Avoid creating an automatic index on a column that is known to be not very
selective.

FossilOrigin-Name: 70409763f70faa2a0f4f072fd318a687b109a0905cc57906ad7f80d2885fe6d9

23 months agoThe previous check-in was a little two aggressive about skipping the
drh [Mon, 27 May 2024 19:52:24 +0000 (19:52 +0000)] 
The previous check-in was a little two aggressive about skipping the
initialization of entries in the CellArray.ixNx array.  Fixed here.

FossilOrigin-Name: 1b6d1fbcdecf14bc79dc7b5df50e585d2fcc1484a9987b863c190e8f7ba2c39f

23 months agoFix typo in comment used to generate parts of the documentation.
drh [Mon, 27 May 2024 18:15:08 +0000 (18:15 +0000)] 
Fix typo in comment used to generate parts of the documentation.
[forum:/forumpost/da5a2ca4db|Forum post da5a2ca4db].

FossilOrigin-Name: 428aadf0c71473ccb0681b2b7146281c62949ee99556873e49895d44eec7aee5

23 months agoVery small performance increase and size reduction by removing unnecessary
drh [Mon, 27 May 2024 15:13:49 +0000 (15:13 +0000)] 
Very small performance increase and size reduction by removing unnecessary
ALWAYS() macros from the btree balance logic and replacing them with
special initialization of CellArray and some assert()s.

FossilOrigin-Name: 32b79041d9b6858e4ffade5841898619c7d25d20c4638bf85447a2ca9cc4a3d3

23 months agoDoc typo fix. No code changes.
stephan [Mon, 27 May 2024 13:41:46 +0000 (13:41 +0000)] 
Doc typo fix. No code changes.

FossilOrigin-Name: eaf07fe69f383938dd394f58cedad3f16f146d9b48e66bc1ba17446cf75ffb3f

23 months agoFor compatibility with PostgreSQL, when right-hand side of the ->> operator
drh [Mon, 27 May 2024 13:24:39 +0000 (13:24 +0000)] 
For compatibility with PostgreSQL, when right-hand side of the ->> operator
is negative, it should index from the right side of the JSON array on the
left-hand side.

FossilOrigin-Name: 82365a45b96536c1146a384e5d3efce80a6ec469a54713c7f40bf15eb834b5fd

23 months agoFix a possible buffer overwrite in the ".import" command. [forum:/forumpost/0c447f054...
dan [Mon, 27 May 2024 11:35:05 +0000 (11:35 +0000)] 
Fix a possible buffer overwrite in the ".import" command. [forum:/forumpost/0c447f0548|forum post 0c447f0548].

FossilOrigin-Name: 0fd958fa9b56a8ef254127e29800ca2a267590e86edf739bd339239b25a5da6e

23 months agoAdd new assert() statements to help out a static analyzer. Response to
drh [Mon, 27 May 2024 11:31:02 +0000 (11:31 +0000)] 
Add new assert() statements to help out a static analyzer.  Response to
[forum:/forumpost/17fe8ac32e0de4f5|forum post 17fe8ac32e0de4f5].

FossilOrigin-Name: 857f6d530949221d154b5120ecc2aa906418bec6f69d1c13197a432ba3cad8eb

23 months agoEnsure that sqlite3ViewGetColumnNames() returns non-zero on any error.
drh [Sat, 25 May 2024 23:13:15 +0000 (23:13 +0000)] 
Ensure that sqlite3ViewGetColumnNames() returns non-zero on any error.
dbsqlfuzz d9de2a508f693e5a228d7a01d5341e3c64326fbb.

FossilOrigin-Name: 57aeb3a287fc190bf8d438a7b03d6715c05fd3fd71559c6a14d7bd910d37b38d

23 months agoEnsure that queries like "SELECT func(a) FROM tab GROUP BY 1" only call the
drh [Fri, 24 May 2024 23:44:48 +0000 (23:44 +0000)] 
Ensure that queries like "SELECT func(a) FROM tab GROUP BY 1" only call the
func() function once per row.  Fix for the issue described in
[forum:/forumpost/bf8f43aa522c2299|forum thread bf8f43aa522c2299].

FossilOrigin-Name: 663f5dd32d9db83249fcf85602a756464ece74e1899dc881ac9519d872638441

23 months agoFix another fts5 problem related to unknown tokenizer modules.
dan [Fri, 24 May 2024 21:38:37 +0000 (21:38 +0000)] 
Fix another fts5 problem related to unknown tokenizer modules.

FossilOrigin-Name: e78b7783040ef1ad34d4287af8a7a5998d360d50076e0de42a116d9a96fe74b4

23 months agoFix a crash in fts5 that could occur within "PRAGMA integrity_check" if the specified...
dan [Fri, 24 May 2024 21:23:36 +0000 (21:23 +0000)] 
Fix a crash in fts5 that could occur within "PRAGMA integrity_check" if the specified tokenizer was unknown.

FossilOrigin-Name: 061d7b69e6a43474cd7123a69f4ee65b5649a0b5e51474343defef5ae5262657

23 months agoWhen omitting result columns for the vector-IN optimization, make sure that group-by-consistency
drh [Fri, 24 May 2024 20:18:16 +0000 (20:18 +0000)] 
When omitting result columns for the vector-IN optimization, make sure that
any result-set column references in both the ORDER BY clause and the
GROUP BY clause are updated appropriately.

FossilOrigin-Name: f890812df0a57fcd201647640d8b9ee26047cd93cd7171bc6fd050f574649345

23 months agoEnsure that queries like "SELECT indeterministic(a) FROM tbl GROUP BY 1" invoke the...
dan [Fri, 24 May 2024 18:31:39 +0000 (18:31 +0000)] 
Ensure that queries like "SELECT indeterministic(a) FROM tbl GROUP BY 1" invoke the indeterministic function only once for each row of tbl.

FossilOrigin-Name: 4555d66547e28cb110e1012b145bcf3aafb5d4bde05e9d27bcb4ca33837b28f5

23 months agoAdd the stmtrand() extension function for use in testing.
drh [Fri, 24 May 2024 14:16:06 +0000 (14:16 +0000)] 
Add the stmtrand() extension function for use in testing.

FossilOrigin-Name: 5c97a5b9d163b1c427e002f3734687ca0384bc0da6a90fc4bfd358c654d3a7b3

23 months agoFix an "ifcapable" expression in values.test.
dan [Fri, 24 May 2024 13:33:39 +0000 (13:33 +0000)] 
Fix an "ifcapable" expression in values.test.

FossilOrigin-Name: b8442d2a6012b1f2e15381613267db0982e36bb4c748b15b56e668e0d0a3d0d2

2 years agoFix the window-function group_concat() so that it returns an empty string
drh [Thu, 23 May 2024 23:26:04 +0000 (23:26 +0000)] 
Fix the window-function group_concat() so that it returns an empty string
if it has one or more empty string inputs.  This fixes
a bug introduced by [c6da39115d3e2b0f] on 2019-03-26 (version 3.28.0) and
reported by [forum/forumpost/bf8f43aa522c2299|forum post bf8f43aa522c2299].

FossilOrigin-Name: cec6bb3fc9932ea78ec8e63d9c2d4e56a4d94b8973b9ea46033cc4baa87c0476

2 years agoMerge various enhancements that were being held on a branch until after the
drh [Thu, 23 May 2024 15:05:57 +0000 (15:05 +0000)] 
Merge various enhancements that were being held on a branch until after the
3.46.0 release.  (1) Allow arbitrary expressions in the second argument to
the RAISE() function. (2) Performance optimization to the OP_OpenRead and
OP_OpenWrite bytecode operators. (3) Allow FTS5 tables to be dropped even if
the associated tokenizer is not available.  (4) Performance optimizations in
FTS5.  (5) Generate better bytecode to improve performance of ONEROW scans.

FossilOrigin-Name: 1e5385ffc30743412ade1536583504eec36790cac5355042aa1e12d8d2271d1f

2 years agoIncrease the version number to 3.47.0 to begin the next development cycle.
drh [Thu, 23 May 2024 14:58:31 +0000 (14:58 +0000)] 
Increase the version number to 3.47.0 to begin the next development cycle.

FossilOrigin-Name: 20e228a22e4c5a8d62fae003ac176de62126d8e121871c5ca14a5480c4d4b6a2

2 years agoVersion 3.46.0 version-3.46.0
drh [Thu, 23 May 2024 13:25:27 +0000 (13:25 +0000)] 
Version 3.46.0

FossilOrigin-Name: 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e

2 years agoEnsure an sqlite_dbdata cursor is properly reset before being used again, even if...
dan [Tue, 21 May 2024 17:37:50 +0000 (17:37 +0000)] 
Ensure an sqlite_dbdata cursor is properly reset before being used again, even if it has already encountered database corruption.

FossilOrigin-Name: 3210e1ca4d0efedf9710c97abd050ba10d3af98cb1f029c26daa84daf42fbc7e

2 years agoDo not attempt to run mmapcorrupt.test with builds that do not support mmap().
dan [Tue, 21 May 2024 14:54:46 +0000 (14:54 +0000)] 
Do not attempt to run mmapcorrupt.test with builds that do not support mmap().

FossilOrigin-Name: 54a49f1847f95c377f0f611eb10f635b879bba8c2eb25e65e2f66a56f4f9a505

2 years agoFix harmless compiler warnings.
drh [Tue, 21 May 2024 13:34:26 +0000 (13:34 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: aab59f9f7c1c4cfac4d29d7c7a381583295312baf3b9a75e30a617b1541e12e1

2 years agoFix the -> and ->> operators so that when the RHS is a string that looks like
drh [Tue, 21 May 2024 11:11:29 +0000 (11:11 +0000)] 
Fix the -> and ->> operators so that when the RHS is a string that looks like
a number, it is still treated as a string, because that is what PG does.
[forum:/forumpost/9e52cdfe15c3926e|Forum post 9e52cdfe15c3926e].

FossilOrigin-Name: de8182cf1773ac0d04268d896a613841cf6bf61f9f030342170657d5e06f2acb

2 years agoOmit a capi3 test from 2007 that depends upon undefined behavior (UAF).
drh [Mon, 20 May 2024 19:59:32 +0000 (19:59 +0000)] 
Omit a capi3 test from 2007 that depends upon undefined behavior (UAF).

FossilOrigin-Name: a60a0b75137c015e97b8dcd0070444fcb608f502ce88b2ee744dd6230dbdc120

2 years agoDo not run the tests in recovercorrupt4.test with the inmemory_journal permutation.
dan [Mon, 20 May 2024 19:51:06 +0000 (19:51 +0000)] 
Do not run the tests in recovercorrupt4.test with the inmemory_journal permutation.

FossilOrigin-Name: c13205d66b8406cccfc937c88ac515fa758fe2ade8b3d30f0c1e79fe974e9600

2 years agoImprovements to the documentation of sqlite3_vtab_distinct(). Do not allow
drh [Mon, 20 May 2024 17:52:35 +0000 (17:52 +0000)] 
Improvements to the documentation of sqlite3_vtab_distinct().  Do not allow
sqlite3_vtab_distinct() to return 2 or 3 if the rowid column of the virtual
table is used, as doing so might lead to an incorrect answer.

FossilOrigin-Name: 08058d66d1bde4fcf8324482ee4c6c030c681383470d5076b6f75b74aac2ae29

2 years agoImprovements to the sqlite3_vtab_distinct() documentation. vtab-distinct-fix
drh [Mon, 20 May 2024 16:00:27 +0000 (16:00 +0000)] 
Improvements to the sqlite3_vtab_distinct() documentation.

FossilOrigin-Name: 6ee041d34f292b94701919f51bbb9e12bcb9e0c4f45e4c0b83f30ff328070637

2 years agoFix the definition of sqlite3_vtab_distinct() such that return codes 2 and
drh [Sat, 18 May 2024 20:00:08 +0000 (20:00 +0000)] 
Fix the definition of sqlite3_vtab_distinct() such that return codes 2 and
3 mean that all rows must be distinct over "colUsed" which is a superset of
"aOrderBy".  Also, disallow return codes 2 and 3 if the rowid of the virtual
table is accessed.

FossilOrigin-Name: 922731ce98c0ce7837784ff7966049e59fa73da2aa04abf3506503b6fc4aa048

2 years agoJS error message and doc typos reported in the forum. No code changes.
stephan [Sat, 18 May 2024 15:21:45 +0000 (15:21 +0000)] 
JS error message and doc typos reported in the forum. No code changes.

FossilOrigin-Name: 1a073f9acfb691eebf4a8cc78a72ff47ebbb6aba4acede6755fa3faefae48f2b

2 years agoImprovements to a VDBE comment. No changes to anything that affects queries.
drh [Fri, 17 May 2024 22:51:03 +0000 (22:51 +0000)] 
Improvements to a VDBE comment.  No changes to anything that affects queries.

FossilOrigin-Name: c2188da860a1debd7c5d28b223deeef15035c33c2c5aefae9d9b620b6a2b4677

2 years agoMerge branches "fix-onerow-opt", "faster-openread", "fts5-delay-tokenizer" and "enhan... pending-3.46
dan [Fri, 17 May 2024 14:26:32 +0000 (14:26 +0000)] 
Merge branches "fix-onerow-opt", "faster-openread", "fts5-delay-tokenizer" and "enhanced-raise", each containing minor enhancements prepared for 3.47, into this branch.

FossilOrigin-Name: 6dc6472175bccbed15ebf6811c209d1a0b5fad60158fb32040210f2cdae916a6

2 years agoFix a problem in where.c preventing SQLite from identifying some ONEROW scans, leadin... fix-onerow-opt
dan [Fri, 17 May 2024 13:56:38 +0000 (13:56 +0000)] 
Fix a problem in where.c preventing SQLite from identifying some ONEROW scans, leading to (slightly) sub-optimal byte-code.

FossilOrigin-Name: b41e71208abcdf988f57c3fd7e6a372bbaf442c32a8e2c051beb8d45c8001e0f

2 years agoAdd extra tests for the error messages generated by sqlite3_declare_vtab() when passe...
dan [Thu, 16 May 2024 16:22:51 +0000 (16:22 +0000)] 
Add extra tests for the error messages generated by sqlite3_declare_vtab() when passed something other than a well-formed CREATE TABLE statement.

FossilOrigin-Name: 5fa0c2a026f0467af3a76ea80cee8168b7a49553c350f642d1dff02ff9e7aeed

2 years agoThe sqlite3_declare_vtab() interface should return SQLITE_ERROR, not
drh [Thu, 16 May 2024 15:57:42 +0000 (15:57 +0000)] 
The sqlite3_declare_vtab() interface should return SQLITE_ERROR, not
SQLITE_MISUSE when a nonsense SQL input is provided, for legacy compatibility.
[forum:/forumpost/4b875d7b2a|Forum post 4b875d7b2a].

FossilOrigin-Name: 1ec2961a0341619ae88832942b52606b3246fc0de07ca6da0300e4bfc656ecf0

2 years agoFix a case where an error in the ORDER BY clause of an aggregate function that is...
drh [Thu, 16 May 2024 00:20:43 +0000 (00:20 +0000)] 
Fix a case where an error in the ORDER BY clause of an aggregate function that is part of a trigger body might cause an assert() to fail in an ALTER TABLE command.  dbsqlfuzz 899d9255555a07f1fe11a0bb51a2fe197b3150cd

FossilOrigin-Name: 953271f29e7bd6ba9b85f73250b1c22b08eef317f9ac3c7c3d92cbaa57d7efd5

2 years agoBack out the assert() fixes from [a9443dbfbe25e588] and alter-table-fix
drh [Wed, 15 May 2024 23:36:24 +0000 (23:36 +0000)] 
Back out the assert() fixes from [a9443dbfbe25e588] and
[3afaeac56dff58db] (but keep the corresponding test cases) because they
are both made obsolete by the previous fix on this branch.

FossilOrigin-Name: 3120c7c8a3565b8a3ca321129c09db96839c2f9af1777fc7a1668fef81973603

2 years agoFix a case where an error in the ORDER BY clause of an aggregate function that is...
dan [Wed, 15 May 2024 21:38:04 +0000 (21:38 +0000)] 
Fix a case where an error in the ORDER BY clause of an aggregate function that is part of a trigger body might cause an assert() to fail in an ALTER TABLE command.

FossilOrigin-Name: b79a8be37b44c1eff7d00f7af7cd9d0e13614ce5961bb88ddb9ec63f6a846c78

2 years agoIf there is no data available for a field in a corrupted record, but the type is...
dan [Wed, 15 May 2024 15:06:27 +0000 (15:06 +0000)] 
If there is no data available for a field in a corrupted record, but the type is available, have the recovery extension substitute 0, 0.0, '' or X'' instead of a NULL value.

FossilOrigin-Name: 8eb326c24981647e2df90e4b9d75db52a552bd997bd821f5898c7ff3fb93a57d

2 years agoOptimize queries against fts5vocab(row) tables that do use the "cnt" column. fts5-delay-tokenizer
dan [Tue, 14 May 2024 19:41:19 +0000 (19:41 +0000)] 
Optimize queries against fts5vocab(row) tables that do use the "cnt" column.

FossilOrigin-Name: 96a591c202cb4218999ece3de063bf466b6fd81bd23383893f3913ecb52dda36

2 years agoAvoid calculating the value of the "cnt" column for fts5vocab(row) queries that do...
dan [Tue, 14 May 2024 19:09:54 +0000 (19:09 +0000)] 
Avoid calculating the value of the "cnt" column for fts5vocab(row) queries that do not use it.

FossilOrigin-Name: c0c91e306c252ce1b398e92ab958e2a3de0fc43db05cfdffc548380654fc9f13

2 years agoHave fts5 tables delay initializing the tokenizer until it is first used in all cases...
dan [Tue, 14 May 2024 17:16:09 +0000 (17:16 +0000)] 
Have fts5 tables delay initializing the tokenizer until it is first used in all cases where the tokenizer is not "trigram".

FossilOrigin-Name: ca4fdcb8ae95d2a61236b949f852d2bf25ea2dbbff7eedafbd8eb84e8fd96687

2 years agoAllow existing fts5 tables to be dropped even if the associated tokenizer is not...
dan [Mon, 13 May 2024 20:06:08 +0000 (20:06 +0000)] 
Allow existing fts5 tables to be dropped even if the associated tokenizer is not available.

FossilOrigin-Name: 69ef47eeee8b53684c321393be34f03600694fbc86377f8720ff80307846aff6

2 years agoOptimization in the implementation of OP_OpenRead and OP_OpenWrite faster-openread
drh [Sun, 12 May 2024 00:26:08 +0000 (00:26 +0000)] 
Optimization in the implementation of OP_OpenRead and OP_OpenWrite

FossilOrigin-Name: 3a256a1667b15702dc5048fdf2fdba9c1e551106ce8cf391360f156fab35ecc5

2 years agoAdd tests to bestindexC.test. No changes to code.
dan [Sat, 11 May 2024 16:44:56 +0000 (16:44 +0000)] 
Add tests to bestindexC.test. No changes to code.

FossilOrigin-Name: 58d938c0e03c3c8d8796c537f89e69734ba6263d60ba37e345259cb6fdffbea5

2 years agoFix aggregate function processing to correctly deal with OOMs inside of
drh [Fri, 10 May 2024 18:24:15 +0000 (18:24 +0000)] 
Fix aggregate function processing to correctly deal with OOMs inside of
sqlite3ParserAddCleanup().
(dbsqlfuzz b2d11ca70e55ee8bde48ae0b53fa3e9355812f95).
Also add improved testing support by causing sqlite3FaultSim(300) to
simulate an OOM inside of sqlite3ParserAddCleanup() and by adding
improved fault-sim support to the CLI.

FossilOrigin-Name: c6fd70b3c23fa00eaac9286d4a67e5c8ac76f926c11c220250c34032647bedc1

2 years agoAdd a test for the fixes on this branch. cleanup-testing
dan [Fri, 10 May 2024 18:15:03 +0000 (18:15 +0000)] 
Add a test for the fixes on this branch.

FossilOrigin-Name: 716088d673b80446ea5f9cb83f6aad8a9ea2ec769d4894e02ab916930e4cf169

2 years agoThe sqlite3FaultSim(300) error from [1e8863909ac369e5] must be treated as
drh [Fri, 10 May 2024 18:10:34 +0000 (18:10 +0000)] 
The sqlite3FaultSim(300) error from [1e8863909ac369e5] must be treated as
an OOM, since it simulates an OOM.  Also fix deferred deletion of Expr objects
from [a53bdd311c4154fd] so that it does not corrupt the AST if an OOM occurs.

FossilOrigin-Name: c623d9a51e0ae6b4a8e1186714d14e7aa3df55246e123323481f07f07749dea5

2 years agoImprovements to the ".testctrl fault_install" command in the CLI.
drh [Fri, 10 May 2024 17:05:24 +0000 (17:05 +0000)] 
Improvements to the ".testctrl fault_install" command in the CLI.

FossilOrigin-Name: 48b34ded82d0cec8a7dd67431f057b320b8c459b1b78c0fbf79bc2b355e85d4e

2 years agoAdd an sqlite3FaultSim(300) call to the sqlite3ParserAddCleanup() routine
drh [Fri, 10 May 2024 16:28:35 +0000 (16:28 +0000)] 
Add an sqlite3FaultSim(300) call to the sqlite3ParserAddCleanup() routine
for more precise simulation of OOM errors in that routine.

FossilOrigin-Name: 1e8863909ac369e5e62e82e53b6e5a7cc6794100cef281ede00b0bb9bbc28594

2 years agoSquelch two OMIT-flag-related warnings reported in [forum:388243d9882067a9|forum...
stephan [Fri, 10 May 2024 09:26:53 +0000 (09:26 +0000)] 
Squelch two OMIT-flag-related warnings reported in [forum:388243d9882067a9|forum post 388243d9882067a9]. No functional changes.

FossilOrigin-Name: 1d6716054d7fc50df237996c3db30e5fb8e32acbf48cb8b9af472360515945c4

2 years agoAdd a maintenance-reminder comment explaining [dc58ed65492857].
stephan [Thu, 9 May 2024 18:39:54 +0000 (18:39 +0000)] 
Add a maintenance-reminder comment explaining [dc58ed65492857].

FossilOrigin-Name: 857f5d7fadce1cfe30b3468826f403f736cfecacb1eb6d3b858b01ea3cfd6ffc

2 years agoReformulate a for-in loop to a for loop in wasm.xWrap() to work around a downstream...
stephan [Thu, 9 May 2024 18:00:14 +0000 (18:00 +0000)] 
Reformulate a for-in loop to a for loop in wasm.xWrap() to work around a downstream framework-level misbehavior, as reported in [forum:b549992634b55104|forum post b549992634b55104].

FossilOrigin-Name: dc58ed654928574ef254af289bd21c654c587aac80aea36ab96772c35d4ca754

2 years agoRename a shadowed local var, as reported in [forum:2ba65af3148585cf|forum post 2ba65a...
stephan [Wed, 8 May 2024 17:57:45 +0000 (17:57 +0000)] 
Rename a shadowed local var, as reported in [forum:2ba65af3148585cf|forum post 2ba65af31]. No functional changes.

FossilOrigin-Name: d030c87c4d410e9ca2b90ec7cb63e752f4490c60e2feac84f233861593142c7d

2 years agoAllow arbitrary expressions as the second argument to RAISE(). enhanced-raise
drh [Wed, 8 May 2024 17:42:13 +0000 (17:42 +0000)] 
Allow arbitrary expressions as the second argument to RAISE().

FossilOrigin-Name: 003e1c8c27824cb917b3869bdf9000f32ff0b6887a2aff8516712cfe865cf34d

2 years agoFix a hyperlink typo in session documentation.
drh [Wed, 8 May 2024 11:51:56 +0000 (11:51 +0000)] 
Fix a hyperlink typo in session documentation.

FossilOrigin-Name: 42d67c6fed3a5f21d7b71515aca471ba61d387e620022735a2e7929fa3a237cf

2 years agoFix bug in test script sessionconflict.test.
dan [Tue, 7 May 2024 19:45:05 +0000 (19:45 +0000)] 
Fix bug in test script sessionconflict.test.

FossilOrigin-Name: e29decb8b1991bb586f41fd74bbaa4d6c4bd63e22617145828b2500d697d7869

2 years agoEnsure successive scans of pragma virtual tables return consistent rowids.
dan [Tue, 7 May 2024 17:58:07 +0000 (17:58 +0000)] 
Ensure successive scans of pragma virtual tables return consistent rowids.

FossilOrigin-Name: 6838bf3ac130c5862f5fbc718b3e49ece154fa840b6539af2616cffa31e73808

2 years agoFix a compilation error in test/lemon-test01.y, reported in [forum:f0ad095705|forum...
stephan [Tue, 7 May 2024 13:20:24 +0000 (13:20 +0000)] 
Fix a compilation error in test/lemon-test01.y, reported in [forum:f0ad095705|forum post f0ad095705].

FossilOrigin-Name: 576b68c8b5132eb8901789b7fafb37e5ad7a00c1c7154090b42ddc5934ac0396

2 years agoWhen extracting links from sqlar archives, clobber any existing file or link, and...
dan [Mon, 6 May 2024 20:21:31 +0000 (20:21 +0000)] 
When extracting links from sqlar archives, clobber any existing file or link, and do not call utimes() to set the timestamp - it looks through the link and operates on the target.

FossilOrigin-Name: 2bf8c3f99ad8b74f707d17272fa12b674bec66082d3e8349ebef3dac42ba0782

2 years agoOmit redundant unary + operators from the AST.
drh [Mon, 6 May 2024 20:18:30 +0000 (20:18 +0000)] 
Omit redundant unary + operators from the AST.

FossilOrigin-Name: f81cc149e5e308785502b36e83eaaf3d31c72520793e0596d5496abd70f9cda8

2 years agoAvoid unnecessary recursion in sqlite3ExprDeleteNN(). This complicates the
drh [Mon, 6 May 2024 19:04:46 +0000 (19:04 +0000)] 
Avoid unnecessary recursion in sqlite3ExprDeleteNN().  This complicates the
code, but it is needed to prevent nuisance "stack overflow" reports from
OSSFuzz while it is running the latest ASAN.

FossilOrigin-Name: 70abc144ca90a58ea25dc2d90683545246c084d961215c20ec070b0abe640371

2 years agoAdd new sessions API sqlite3changegroup_add_change().
dan [Mon, 6 May 2024 17:55:19 +0000 (17:55 +0000)] 
Add new sessions API sqlite3changegroup_add_change().

FossilOrigin-Name: 5eaab43ce48bb8d710f784ecd6aa9a4b3e708b44b0f7e49daf66a3f8bc2b9873

2 years agoEdit comments in sqlite3session.h. changegroup-add-change
dan [Mon, 6 May 2024 17:32:26 +0000 (17:32 +0000)] 
Edit comments in sqlite3session.h.

FossilOrigin-Name: 49f84878e21f85d44d8429cdc2908f87383e59737e1af3fdbccf0c276d883567

2 years agoAdd tests for sqlite3changegroup_add_change().
dan [Mon, 6 May 2024 17:21:23 +0000 (17:21 +0000)] 
Add tests for sqlite3changegroup_add_change().

FossilOrigin-Name: 9d67bedc20c3a59e5488f0eaea6a6611940a9cb63f7cf5e687b061cb5d510943

2 years agoFix problem in sqlar_uncompress() when being used to extract symbolic links.
dan [Mon, 6 May 2024 11:27:47 +0000 (11:27 +0000)] 
Fix problem in sqlar_uncompress() when being used to extract symbolic links.

FossilOrigin-Name: 4d90c3f179a3d7355b6b0202faf56f0be4be56986920576e528208cb84daa4af

2 years agoAdd comment to the test/lemon-test01.y file indicating that it does not work
drh [Sun, 5 May 2024 10:00:02 +0000 (10:00 +0000)] 
Add comment to the test/lemon-test01.y file indicating that it does not work
and is for historical reference only.

FossilOrigin-Name: 9bdf73a8d4a3b4a72f2882252f9ed29a6f1a26d3f50c071f27455bcf10458c4b

2 years agoAdd new sessions API sqlite3changegroup_add_change().
dan [Sat, 4 May 2024 21:10:24 +0000 (21:10 +0000)] 
Add new sessions API sqlite3changegroup_add_change().

FossilOrigin-Name: 73647db1ddfdaf40cbf18f1e47c10b4a906489f6d34d7667f0f2ff532f1eb37c

2 years agoAdd test cases to test/in7.test. No code changes.
dan [Sat, 4 May 2024 16:50:47 +0000 (16:50 +0000)] 
Add test cases to test/in7.test. No code changes.

FossilOrigin-Name: 8c3086f9fe502dfc4a1fa610a23794fb037721df29dc5d2126cfb749a9d44a50

2 years agoAssume that an SQL function is able to return a subtype if any of its
drh [Sat, 4 May 2024 15:10:37 +0000 (15:10 +0000)] 
Assume that an SQL function is able to return a subtype if any of its
arguments are SQL functions that are able to return subtypes.  This closes
a corner-case hole in the patch at [ba789a7804ab96d8].

FossilOrigin-Name: b36d499e4cdb41a5d7e44a1c4347a059d7654f85ade9c5c04d18ac95ddc09fde

2 years agoAssume that a function is able to return a subtype if either (1) it is itself func-rw-subtype
drh [Sat, 4 May 2024 15:04:45 +0000 (15:04 +0000)] 
Assume that a function is able to return a subtype if either (1) it is itself
marked with SQLITE_RESULT_SUBTYPE, or (2) one of its arguments is a function
that is able to return a subtype.  This check-in backs out the code changes
from the previous two on this same branch, but keeps the test cases from
the previous two.

FossilOrigin-Name: f16b200f25a0ec59ad765d254d81c3ffdba21f79e6e82807a7b80d00627952e2

2 years agoFunctions that pass through the sqlite3_value of one of their arguments must
drh [Sat, 4 May 2024 11:31:34 +0000 (11:31 +0000)] 
Functions that pass through the sqlite3_value of one of their arguments must
also be marked as SQLITE_RESULT_SUBTYPE, in case one of their arguments has
a subtype.

FossilOrigin-Name: 2f9fba931d9f80b3d5dffb175180098756bccc6a8f665d7aaf8826970ab60d72

2 years agoThe coalesce(), ifnull(), and iif() functions pass through subtype values
drh [Fri, 3 May 2024 19:35:43 +0000 (19:35 +0000)] 
The coalesce(), ifnull(), and iif() functions pass through subtype values
from their arguments, and hence need to have the SQLITE_RESULT_SUBTYPE flag
set.  This fixes an corner-case for the patch at [ba789a7804ab96d8].

FossilOrigin-Name: cdd1610c44876623e629bb8e5779ea689e6d23c545552b088eca63ad2d1cf8da

2 years agoFix a problem with queries that use "IN(...) ORDER BY ... NULLS LAST" or similar...
dan [Thu, 2 May 2024 19:22:23 +0000 (19:22 +0000)] 
Fix a problem with queries that use "IN(...) ORDER BY ... NULLS LAST" or similar introduced by [d7648e21605a0b38].

FossilOrigin-Name: 26b2d9390f1273ee0e3f3c96f6bc5bf0e9c1dcfd0d9ecd993dba487ef5a07f7e

2 years agoAvoid an assert failure accessible only when internal testing features are enabled...
dan [Thu, 2 May 2024 18:16:23 +0000 (18:16 +0000)] 
Avoid an assert failure accessible only when internal testing features are enabled. dbsqlfuzz crash-66abacda6bca6bd531e25595e8c8068e2c710326.txt.

FossilOrigin-Name: fbc446daac761dd1b66a85c9b61e1d5af194a8fd665600c43a874da38cc6ec10

2 years agoFix a case where the recovery extension might write uninitialized data to the recover...
dan [Thu, 2 May 2024 17:46:52 +0000 (17:46 +0000)] 
Fix a case where the recovery extension might write uninitialized data to the recovered database.

FossilOrigin-Name: 8519b4d0393ed17eed06bceffbc891fe8cae0bc1d466a79eba0602ef46b07c56

2 years agoAvoid an OP_Next in cases where an IN(...) query against a UNIQUE index may return...
dan [Thu, 2 May 2024 14:48:58 +0000 (14:48 +0000)] 
Avoid an OP_Next in cases where an IN(...) query against a UNIQUE index may return at most 1 row.

FossilOrigin-Name: d7648e21605a0b381b1935a47e5a77bdfacc4cc96f03d6bb7956f8f4e6a40648

2 years agoFix the CREATE TABLE performance issue described by
drh [Thu, 2 May 2024 12:14:31 +0000 (12:14 +0000)] 
Fix the CREATE TABLE performance issue described by
[forum:/forumpost/4cf69794d9dfff7c|forum thread 4cf69794d9dfff7c] in two
different ways:  (1) Omit the call to PRAGMA integrity_check('X') that was
being done after CREATE TABLE "X" because the result was being ignored and
the integrity_check was not doing anything other than burning CPU cycles.
(2) Do not interpret the argument to PRAGMA integrity_check as a number if it
is in fact a string that looks like a number.

FossilOrigin-Name: 71f08b912251c8a3ac1bd8e344903336648e4187f7493f8c126e60b3b51b9f09

2 years agoAdd a test case to the fix to PRAGMA integrity_check in the previous check-in. faster-create
drh [Thu, 2 May 2024 12:00:36 +0000 (12:00 +0000)] 
Add a test case to the fix to PRAGMA integrity_check in the previous check-in.

FossilOrigin-Name: 39a57b596d309d9e2d4c59409fe5d36e0665781ce0307d157ff8b6e883161bbb

2 years agoDo not accept a string that looks like a number used as an argument to
drh [Thu, 2 May 2024 11:52:31 +0000 (11:52 +0000)] 
Do not accept a string that looks like a number used as an argument to
PRAGMA integrity_check as a number.  Treat it as a table name that just
happens to look like a number.

FossilOrigin-Name: b04e7a23478f1012e501a810f3e09cca81a66e802f5f72cae80c81120174e2cb

2 years agoOmit the OP_SqlExec to "PRAGMA integrity_check" added by [348fa7aaf7958b3f]
drh [Thu, 2 May 2024 11:51:26 +0000 (11:51 +0000)] 
Omit the OP_SqlExec to "PRAGMA integrity_check" added by [348fa7aaf7958b3f]
because it is a no-op.  Even if the integrity_check failes, the CREATE TABLE
is stull successful.  The OP_SqlExec just burns CPU cycles for no reason.

FossilOrigin-Name: 532795acd1c800751737fe70148f9ae691e9cf11b836577f8538421d24cab2fe

2 years agoAvoid an OP_Next in cases where an IN(...) query against a UNIQUE index may return... unique-in-opt
dan [Wed, 1 May 2024 19:48:24 +0000 (19:48 +0000)] 
Avoid an OP_Next in cases where an IN(...) query against a UNIQUE index may return at most 1 row.

FossilOrigin-Name: 560f64157d2fe40e107582eebb6526185c9c43305e364f4132e182dbec5b210a

2 years agoFix another problem in the recovery extension where a corrupt sqlite_schema table...
dan [Wed, 1 May 2024 16:25:46 +0000 (16:25 +0000)] 
Fix another problem in the recovery extension where a corrupt sqlite_schema table could lead to excessive memory consumption.

FossilOrigin-Name: 1c7e33a8aa0e6122b5ef606e4a7d95e8ecd9440216d4b099fe8f2a40653422be

2 years agoFix a problem causing the recovery extension to use excessive memory and CPU time...
dan [Wed, 1 May 2024 14:42:20 +0000 (14:42 +0000)] 
Fix a problem causing the recovery extension to use excessive memory and CPU time in some cases.

FossilOrigin-Name: 8de85170d53e1d2a2abe14508a222377b9493e25f3174b8f0f773427deb8df26

2 years agoAvoid 32-bit overflow when calculating ncycle for ".scanstats vm".
dan [Tue, 30 Apr 2024 19:34:15 +0000 (19:34 +0000)] 
Avoid 32-bit overflow when calculating ncycle for ".scanstats vm".

FossilOrigin-Name: 2858efa06d4fc7b412b892f35f5e9a766b467b4a5b74d602a030d25443f9efb4

2 years agoFix issues in [/info/1e227ad9f413227f|LIMIT/OFFSET support for virtual tables].
drh [Fri, 26 Apr 2024 19:10:15 +0000 (19:10 +0000)] 
Fix issues in [/info/1e227ad9f413227f|LIMIT/OFFSET support for virtual tables].
The first problem was reported by
[forum:/forumpost/c243b8f856|forum post c243b8f856].  That report prompted
an enhancement to the generate_series() (also included in this merge) which
in turn identified other similar issues.

FossilOrigin-Name: 5f6c079d847e3664ec5acaf1b3e989efe0d548c211ae4a18936162b36df89065

2 years agoInternal JS doc touchups. No functional changes.
stephan [Fri, 26 Apr 2024 18:42:50 +0000 (18:42 +0000)] 
Internal JS doc touchups. No functional changes.

FossilOrigin-Name: 626b997b4e727554d7ec8b60fb37b2a94cb861a87325da4ae484bd9aa8961ca5