]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
12 months agoOmit tests that depend on sqlite3_release_memory() in lock5.test when running the... unix-dotfile-fix
dan [Wed, 12 Jun 2024 15:29:37 +0000 (15:29 +0000)] 
Omit tests that depend on sqlite3_release_memory() in lock5.test when running the memsubsys1 or memsubsys2 permutations.

FossilOrigin-Name: 9d63033bf46ddf0f4d9d4ef06d56357fe6165f2370cd19cf81c2f7f61ce224fc

12 months agoDo not attempt to run hot journal rollback tests in lock5.test with the "inmemory_jou...
dan [Wed, 12 Jun 2024 11:41:18 +0000 (11:41 +0000)] 
Do not attempt to run hot journal rollback tests in lock5.test with the "inmemory_journal" permutation, which cannot generate hot journals.

FossilOrigin-Name: 1e6fa95b88cace9e6cac476863d57cfd8de483f83c922ff964b77cbaee6e9ae4

12 months agoHandle the case where unix-dotfile is used with URI parameter nolock=1.
dan [Tue, 11 Jun 2024 20:28:56 +0000 (20:28 +0000)] 
Handle the case where unix-dotfile is used with URI parameter nolock=1.

FossilOrigin-Name: 3925a5b904e159d54455cfc73fe837a9c6ea3a6d60da63afde3242b4d6f67c90

12 months agoFix a problem with rolling back hot journals using the unix-dotfile VFS.
dan [Tue, 11 Jun 2024 20:03:32 +0000 (20:03 +0000)] 
Fix a problem with rolling back hot journals using the unix-dotfile VFS.

FossilOrigin-Name: 4ae3300b79e03381fd7f1033bb7978bb6367369790f17c3bdacac51e205edaf9

12 months agoRemove some dead JS code and update some JS docs.
stephan [Tue, 11 Jun 2024 17:04:43 +0000 (17:04 +0000)] 
Remove some dead JS code and update some JS docs.

FossilOrigin-Name: 6935ac71bad3d36cc519f0325ae4447a674f257309d020cdc0741160fcce0580

12 months agoWhen compiling shell.c in SQLITE_SHELL_FIDDLE mode, ensure that the shell_main_exit...
stephan [Tue, 11 Jun 2024 17:04:02 +0000 (17:04 +0000)] 
When compiling shell.c in SQLITE_SHELL_FIDDLE mode, ensure that the shell_main_exit goto label is reachable.

FossilOrigin-Name: 06e6f64533563ab9c059b773e5f0d78085df716f2624e547b7259f6789c3ffe0

12 months agoChange constant expressions to pre-computed constants, because apparently
drh [Tue, 11 Jun 2024 14:36:56 +0000 (14:36 +0000)] 
Change constant expressions to pre-computed constants, because apparently
MSVC on ARM requires that.
[forum:/forumpost/4feb1685cced0a8e|Forum thread 4feb1685cced0a8e].

FossilOrigin-Name: 6c103aee6f146869a3e0c48694592f2e4c6b57ecdb4450f46e762c38b4e686f1

12 months agoImproved header comment on the sqlite3FpDecode() implementation.
drh [Mon, 10 Jun 2024 12:43:03 +0000 (12:43 +0000)] 
Improved header comment on the sqlite3FpDecode() implementation.
For the fpdecode() SQL function (available in debug builds only) limit
the value of the third parameter (mxRound) to be positive.

FossilOrigin-Name: 56af06fa12104a1fe119d7087746011183af053834eac72d0fb69f60d98054c6

12 months agoDisable the omit-noop-join optimization when there are 64 or more terms in
drh [Sun, 9 Jun 2024 17:34:03 +0000 (17:34 +0000)] 
Disable the omit-noop-join optimization when there are 64 or more terms in
the ORDER BY clause.

FossilOrigin-Name: 40de3939792e17df25598b3e60d1cebcecde2b00832acd55604f14b21398a9a7

12 months agoAllow the query planner access to the argument of LIMIT even if that
drh [Thu, 6 Jun 2024 23:56:36 +0000 (23:56 +0000)] 
Allow the query planner access to the argument of LIMIT even if that
argument is a bound parameter.

FossilOrigin-Name: c4a9dda2809c6e0e3d928e11e5553ead82cd9df551bcd35b11a7d869ef80ab8e

12 months agoOmit bogus tests accidentally added by the privious commit. var-in-limit
drh [Thu, 6 Jun 2024 23:22:32 +0000 (23:22 +0000)] 
Omit bogus tests accidentally added by the privious commit.

FossilOrigin-Name: e94dfe9928750dd98145d4d9920b298f7b0868703b487f86e0db77a41d53ccf9

12 months agoBetter optimize queries that use parameters in the LIMIT clause.
drh [Thu, 6 Jun 2024 15:03:16 +0000 (15:03 +0000)] 
Better optimize queries that use parameters in the LIMIT clause.

FossilOrigin-Name: e58cb304d1e0ec6e30260a165aaccc2cf096ce6c999efb06683c4ef600ee12ef

12 months agoRe-enable [dcc2bb2c562e97e090174], as [296eeb26c816bc73] corrects the wasi-sdk build...
stephan [Thu, 6 Jun 2024 12:22:19 +0000 (12:22 +0000)] 
Re-enable [dcc2bb2c562e97e090174], as [296eeb26c816bc73] corrects the wasi-sdk build problem the former check-in triggered. Reported in [forum:143e40d7f4e79c66|forum post 143e40d7f4e79c66].

FossilOrigin-Name: f66608bd356efe492d1003663c2e1ccd7cfbf2d40393d256f8720149904ad2d5

12 months agoAdjust the parser so that the value of TK_ISNOT is similar to the value of
drh [Thu, 6 Jun 2024 01:21:57 +0000 (01:21 +0000)] 
Adjust the parser so that the value of TK_ISNOT is similar to the value of
TK_IS.  This helps the compiler generate faster switch() statements on the
Expr.op fields when there are cases for TK_ISNOT and other common operators.

FossilOrigin-Name: 34f05c3d89b2dd15e4b0d1ba292df7de3dfc54b505c0ba145cc3db52cf020845

12 months agoSmall performance optimization in the operatorMask routine of the WHERE
drh [Thu, 6 Jun 2024 01:00:50 +0000 (01:00 +0000)] 
Small performance optimization in the operatorMask routine of the WHERE
clause analysis logic.

FossilOrigin-Name: 9d69fc1c87ae673356869ecd89eb19734fd126702c0f9fe595336ecd7be89e08

12 months agoSmall performance optimization in the allowedOp() routine of the WHERE
drh [Thu, 6 Jun 2024 00:49:36 +0000 (00:49 +0000)] 
Small performance optimization in the allowedOp() routine of the WHERE
clause analysis code.

FossilOrigin-Name: 4ba8be544711e07748e8dd3ca6b81f9897906061c0a1a1bb4fb3808dc27f734b

12 months agoFix harmless compilation issues seen with MSVC.
mistachkin [Wed, 5 Jun 2024 20:50:39 +0000 (20:50 +0000)] 
Fix harmless compilation issues seen with MSVC.

FossilOrigin-Name: 816d4749384c7f398912c905a16c83b88f4c55632050b4c6117c61301d1a53e1

12 months agoSmall performance optimization in the codeEqualityTerm() routine of the
drh [Wed, 5 Jun 2024 20:41:36 +0000 (20:41 +0000)] 
Small performance optimization in the codeEqualityTerm() routine of the
code generator.

FossilOrigin-Name: 8080c6eafd1280ea870a6ab1ba715ac5af67387e69771be6cbd46dda77c3eaa8

13 months agoFix an fts5 problem with secure-delete mode causing integrity-check to erroneously...
dan [Wed, 5 Jun 2024 14:47:54 +0000 (14:47 +0000)] 
Fix an fts5 problem with secure-delete mode causing integrity-check to erroneously report a corrupt index.

FossilOrigin-Name: 80bef4d60ba9e3679ea66655ca36fcfaa888775a3d1598d50e9649ad84a95b63

13 months agoFix a very obscure issue where the name resolver could get confused if aliases like...
dan [Wed, 5 Jun 2024 11:36:58 +0000 (11:36 +0000)] 
Fix a very obscure issue where the name resolver could get confused if aliases like "sqlite_schema" or "sqlite_master" were used in a query involving the sqlite_temp_schema table.

FossilOrigin-Name: a096eb7554952f8137c6e9330c328164719fb27e958787fbd503bcd1364e6ae4

13 months agoFix harmless compiler warnings seen with MSVC.
mistachkin [Tue, 4 Jun 2024 19:21:16 +0000 (19:21 +0000)] 
Fix harmless compiler warnings seen with MSVC.

FossilOrigin-Name: 93ac8573eead9b785a24715239e71cd3ef730bf16332cf3b5e264a6491374cac

13 months agoBetter handle WHERE terms that are common to two or more OR branches when planning...
dan [Tue, 4 Jun 2024 17:26:15 +0000 (17:26 +0000)] 
Better handle WHERE terms that are common to two or more OR branches when planning virtual table queries.

FossilOrigin-Name: 1976c3f7e1fe77cf3367710e8ada230a3672ed374e316425164e42b2622526c7

13 months agoFix a couple of memory leaks in the shell tool code that could occur when processing...
dan [Tue, 4 Jun 2024 15:07:38 +0000 (15:07 +0000)] 
Fix a couple of memory leaks in the shell tool code that could occur when processing errors.

FossilOrigin-Name: e84f09d469ee76a5b5e44baf6a69b90c69d4160fa4c32de04a96f868643acd96

13 months agoAllow shell command "testctrl pending_byte" to be used in unsafe-testing mode only.
dan [Tue, 4 Jun 2024 14:32:31 +0000 (14:32 +0000)] 
Allow shell command "testctrl pending_byte" to be used in unsafe-testing mode only.

FossilOrigin-Name: afa45c4f5afc9248ca4a1e775404a460280bb9a58a92eae508ae00fb2f675dc6

13 months agoAddress a corner-case associated with the call-function-once optimization
drh [Mon, 3 Jun 2024 18:04:10 +0000 (18:04 +0000)] 
Address a corner-case associated with the call-function-once optimization
of check-in [663f5dd32d9db832] that was causing a (harmless) use of an
uninitialized bytecode register.
dbsqlfuzz 8a44f675401a8b1f68a43bf813c4f4f72ad8f0ea

FossilOrigin-Name: b37ac2d020873b78efa164036db4056406a67330679f850775da520cd8027cb9

13 months agoOmit an unused #define.
drh [Mon, 3 Jun 2024 12:36:43 +0000 (12:36 +0000)] 
Omit an unused #define.

FossilOrigin-Name: 9c2de28a146e4cdfa4c05bf8dbd4ebb1156c71104001edf68e6dd5db21deb91f

13 months agoModify three #if checks in os_unix.c to improve handling of SQLITE_OMIT_WAL on WASI...
stephan [Mon, 3 Jun 2024 07:22:28 +0000 (07:22 +0000)] 
Modify three #if checks in os_unix.c to improve handling of SQLITE_OMIT_WAL on WASI builds. Based on the discussion in/around [forum:57e918431735128a|forum post 57e918431735128a].

FossilOrigin-Name: 296eeb26c816bc734530cf446922f25be970b901c884df1a98083502f0d1e9f5

13 months agoBe more aggressive about freeing memory associated with the xbestindex-or-terms
drh [Sun, 2 Jun 2024 10:52:35 +0000 (10:52 +0000)] 
Be more aggressive about freeing memory associated with the
sqlite3_index_info.idxStr field.

FossilOrigin-Name: 85dcd0a8479a658203833cfd75f22813faa26d4793ebfbb8843035d683bee105

13 months agoHave fts5.xBestIndex return SQLITE_CONSTRAINT, instead of a large cost, when no usabl...
dan [Sat, 1 Jun 2024 17:56:58 +0000 (17:56 +0000)] 
Have fts5.xBestIndex return SQLITE_CONSTRAINT, instead of a large cost, when no usable plan can be found.

FossilOrigin-Name: 7c470945372dc98610f7c9840ce8cab18c19b655352f0187e4f31040cea77363

13 months agoFurther tests for OR constraints on virtual tables.
dan [Fri, 31 May 2024 20:32:10 +0000 (20:32 +0000)] 
Further tests for OR constraints on virtual tables.

FossilOrigin-Name: ff4a30056f8dbcbd045afdbee485f6671c3580b95187144aa9a77c97dfda2647

13 months agoBetter handle WHERE terms that are common to two or more OR branches when planning...
dan [Fri, 31 May 2024 19:26:22 +0000 (19:26 +0000)] 
Better handle WHERE terms that are common to two or more OR branches when planning virtual table queries.

FossilOrigin-Name: 4edd9b29f58621335b8a562280c991c34804bbba090f90c951261d043cff1965

13 months agoDo not even try star-schema detection if the join has fewer than 5 tables,
drh [Fri, 31 May 2024 15:39:00 +0000 (15:39 +0000)] 
Do not even try star-schema detection if the join has fewer than 5 tables,
since 5 is the minimum for a positive detection.

FossilOrigin-Name: a07ec16bbc056fbc23a7bd58e5e32ef691c13e9babeb542918cf9a01cac40c20

13 months agoDocument the OP_Explain opcode. Add the WhereLoop.rRun value as P3 in
drh [Fri, 31 May 2024 14:39:42 +0000 (14:39 +0000)] 
Document the OP_Explain opcode.  Add the WhereLoop.rRun value as P3 in
OP_Explain opcodes associated with WhereLoops, for testing purposes.

FossilOrigin-Name: 996c46e61d9a53a54018672dd407b8ba8c480dd6795393428f9d5fcb81b47ab5

13 months agoBack out [dcc2bb2c562e97e090174], as it breaks the --with-wasi-sdk builds.
stephan [Thu, 30 May 2024 21:54:16 +0000 (21:54 +0000)] 
Back out [dcc2bb2c562e97e090174], as it breaks the --with-wasi-sdk builds.

FossilOrigin-Name: 62199562c26f77d059aa0bbda42a421a7aece828aa94d14a40c701a6384d1cf6

13 months agoRemove the unconditional SQLITE_OMIT_WAL when building in wasi-sdk mode, per [forum...
stephan [Thu, 30 May 2024 17:56:26 +0000 (17:56 +0000)] 
Remove the unconditional SQLITE_OMIT_WAL when building in wasi-sdk mode, per [forum:80003e91a7a6cb4d|requests in the forum].

FossilOrigin-Name: dcc2bb2c562e97e090174d4d0970bfa1551e5eb4db022e6d232c4dd786818e45

13 months agoEnsure that the second pass call to wherePathSolver() always reports a positive
drh [Thu, 30 May 2024 13:27:29 +0000 (13:27 +0000)] 
Ensure that the second pass call to wherePathSolver() always reports a positive
value for the estimated number of output rows.  This fixes a long-standing
(though exceedingly minor) problem that was only revealed by a new assert()
added yesterday.  dbsqlfuzz 545d6debc2da496ab2b915e33ea34d9a35a935df

FossilOrigin-Name: a47c644fef71f3ab3dc584ea917eaab9a8e5b4c9dcb57bdd29747ba32108e85f

13 months agoUpdate shell.c to use the msteve fork of linenoise, per /chat discussion.
stephan [Thu, 30 May 2024 11:14:16 +0000 (11:14 +0000)] 
Update shell.c to use the msteve fork of linenoise, per /chat discussion.

FossilOrigin-Name: ee92fa8366b743266b17c692499087c0d11b9302d096c3dfb4e6356b467e939e

13 months agoRemove an unused parameter from fts5ConfigParseSpecial(). Compiler-warning
drh [Wed, 29 May 2024 15:16:17 +0000 (15:16 +0000)] 
Remove an unused parameter from fts5ConfigParseSpecial().  Compiler-warning
fix only - no functional changes.

FossilOrigin-Name: c08dd245f7706f2fd2269d700be480477619a722e27e6b439462ae543302c49f

13 months agoUse a heuristic of artifically lowering the cost of fact tables in a
drh [Wed, 29 May 2024 15:08:20 +0000 (15:08 +0000)] 
Use a heuristic of artifically lowering the cost of fact tables in a
star-schema query in order to prevent plans where the fact tables are
in outer loops from being trimmed by the path limiter.  This helps to
generate better (faster) query plans in those particular cases.

FossilOrigin-Name: 38db9b5c83dfb3021333365b2f6b11e3b54afd7033e9f4dadf0c0df1d4b082d8

13 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

13 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

13 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

13 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

13 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

13 months ago[forum:/forumpost/c9b8d923d5|Fix sqldiff out-of-bounds char classification error...
larrybr [Wed, 29 May 2024 03:35:40 +0000 (03:35 +0000)] 
[forum:/forumpost/c9b8d923d5|Fix sqldiff out-of-bounds char classification error mentioned in the forum.]

FossilOrigin-Name: b31933d87301bd93763f0923e0ce06a183700875e6107c9f185faffbd99797d9

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

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

FossilOrigin-Name: aab59f9f7c1c4cfac4d29d7c7a381583295312baf3b9a75e30a617b1541e12e1

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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