]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
20 months agoFix a problem with the fts5 highlight() and snippet() functions when used with tokeni... fts5-trigram-snippet-fix
dan [Tue, 24 Oct 2023 15:53:02 +0000 (15:53 +0000)] 
Fix a problem with the fts5 highlight() and snippet() functions when used with tokenizers like "trigram" that output overlapping tokens. Forum post [forum:/forumpost/63735293ec|63735293ec].

FossilOrigin-Name: d570aa02f79b1d7d3889e33f9eebab1b7edcf5231b1357451eed9a538607de54

20 months agoFix a harmless compiler warning in the expert extension.
drh [Tue, 24 Oct 2023 09:57:54 +0000 (09:57 +0000)] 
Fix a harmless compiler warning in the expert extension.

FossilOrigin-Name: 0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7

20 months agoFix a minor typo in the previous.
drh [Mon, 23 Oct 2023 23:34:53 +0000 (23:34 +0000)] 
Fix a minor typo in the previous.

FossilOrigin-Name: 9d388267e4e6724e2df333fe09d509e87defcfe984c5c2ebe031152d320812d0

20 months agoAdd notes on how to build a statically linked version of sqlite3_analyzer.exe.
drh [Mon, 23 Oct 2023 23:34:24 +0000 (23:34 +0000)] 
Add notes on how to build a statically linked version of sqlite3_analyzer.exe.

FossilOrigin-Name: 99ce9939c861ecc07877e640f75d395afb6502130bf4b5ccea8b98a80a1569ce

20 months agoAdd the sqlite3res file to the Windows build of sqldiff.exe so that the
drh [Mon, 23 Oct 2023 19:51:16 +0000 (19:51 +0000)] 
Add the sqlite3res file to the Windows build of sqldiff.exe so that the
resulting binary shows the SQLite icon.

FossilOrigin-Name: c696a4963bdd010c8161acbf7601078313e7da5ebb3f60381a489a70e5728dea

20 months agoAvoid attempting to delete a file while it is open in test script sessionalter.test.
dan [Mon, 23 Oct 2023 15:30:38 +0000 (15:30 +0000)] 
Avoid attempting to delete a file while it is open in test script sessionalter.test.

FossilOrigin-Name: f20b4a96f747adeb2ed486f06dd7d911f0f24b37df87dcd32d2c3e4b687da9a6

20 months agoRevert an earlier change that considered passing a NULL callback to sqlite3_preupdate...
dan [Mon, 23 Oct 2023 15:24:44 +0000 (15:24 +0000)] 
Revert an earlier change that considered passing a NULL callback to sqlite3_preupdate_hook() to be a misuse. This is required to clear the preupdate hook altogether.

FossilOrigin-Name: 1bf6f0f3bb54933e4e6c730554144934f73a7fac87c97a916b275afd7379f397

20 months agoNew test cases for PRAGMA integrity_check against FTS4 and FTS5 tables.
drh [Mon, 23 Oct 2023 15:23:10 +0000 (15:23 +0000)] 
New test cases for PRAGMA integrity_check against FTS4 and FTS5 tables.

FossilOrigin-Name: 3950d20c3a4433543546ce4495ae07aab3d6cefb163b1f30813a9776c5b962e8

20 months agoFix mutex1.test to take into account that the prng mutex is not (as of [c84e4483cb4...
dan [Mon, 23 Oct 2023 14:24:09 +0000 (14:24 +0000)] 
Fix mutex1.test to take into account that the prng mutex is not (as of [c84e4483cb4]) taken when writing a header to an in-memory journal.

FossilOrigin-Name: c9e37417fcc41f1e975290bf583113ff8f4144c056e8fcd9fafcb432c1a26b18

20 months agoImproved error messages for the xIntegrity method in FTS3/4 and FTS5.
drh [Mon, 23 Oct 2023 13:46:22 +0000 (13:46 +0000)] 
Improved error messages for the xIntegrity method in FTS3/4 and FTS5.

FossilOrigin-Name: df69abc0823f4dd9c051f8d5993d2f447ee0dadab5cef73d670107b1071db255

20 months agoFix sqlite3ExprDup() alignment assertions so that they work on 32-bit
drh [Mon, 23 Oct 2023 12:16:27 +0000 (12:16 +0000)] 
Fix sqlite3ExprDup() alignment assertions so that they work on 32-bit
platforms.

FossilOrigin-Name: 143f95efc7114455b1920f1d2f9a867392740f608d1dda4306005f01238103f8

20 months agoTemporarily disable the ext/expert/expert1-6.0 test, which does not work
drh [Mon, 23 Oct 2023 11:41:41 +0000 (11:41 +0000)] 
Temporarily disable the ext/expert/expert1-6.0 test, which does not work
on my configurations.

FossilOrigin-Name: a41b903d0fe489d20c4a7118a2c91f7c8a78568ce552225f64c2945bb811ea16

20 months agoAdd an SQLITE_OMIT_VIRTUALTABLE block around the new vtab code in "PRAGMA integrity_c...
dan [Mon, 23 Oct 2023 11:34:24 +0000 (11:34 +0000)] 
Add an SQLITE_OMIT_VIRTUALTABLE block around the new vtab code in "PRAGMA integrity_check".

FossilOrigin-Name: ab99eb2b6c50f4f0bb42918b9bdda37e2ef9316bed07de18fa4bd373c49a8b00

20 months agoAdd missing test file fts3fault3.test. Should have been part of [7f41d700].
dan [Mon, 23 Oct 2023 11:18:13 +0000 (11:18 +0000)] 
Add missing test file fts3fault3.test. Should have been part of [7f41d700].

FossilOrigin-Name: 92e64ab63a78445fe20863f9679c55a630a2295ff10c4ce33eab6dfaeef09622

20 months agoMerge fixes for expert handling of UDFs and other UD-whatevers.
larrybr [Mon, 23 Oct 2023 02:08:34 +0000 (02:08 +0000)] 
Merge fixes for expert handling of UDFs and other UD-whatevers.

FossilOrigin-Name: b5d7d07df58bb8e4013b4047e4019b96e506e8ef03ca0abfc9aae06a122b353a

20 months agoFix the shell1.test test so to align with the new behavior imposed by
drh [Mon, 23 Oct 2023 02:01:14 +0000 (02:01 +0000)] 
Fix the shell1.test test so to align with the new behavior imposed by
[bce807cd48763273] - that backslash escapes only work without quoted arguments
in dot-commands of the CLI.

FossilOrigin-Name: 0db82b4281a0e0d5e365553df11e0347f60c00c861c0fb96227059edff3a0ef6

20 months agoClear some picky warnings, sync w/trunk. expert-enhancement
larrybr [Mon, 23 Oct 2023 01:55:35 +0000 (01:55 +0000)] 
Clear some picky warnings, sync w/trunk.

FossilOrigin-Name: ee58425904b36319e016dc69bb5f141bb3565b1723a97490a4b2cfa16b89fbdf

20 months agoFix [f5c01676fd281e93] so that it always preserves 8-byte alignment for Expr
drh [Sun, 22 Oct 2023 23:44:32 +0000 (23:44 +0000)] 
Fix [f5c01676fd281e93] so that it always preserves 8-byte alignment for Expr
objects.  Add new assert() statement to verify this.

FossilOrigin-Name: 678a9728dc6b88d8ef924c86603056df18204bc9a9c4776b9baffd7c5b10c5f2

20 months agoDo not do backslash excape processing on any unquoted strings in dot-commands
drh [Sun, 22 Oct 2023 17:27:55 +0000 (17:27 +0000)] 
Do not do backslash excape processing on any unquoted strings in dot-commands
in the CLI - on Windows or on posix-like systems either one.  This brings the
processing into alignment with the documentation, allows backslash-delimited
filenames on Windows (as long as they are unquoted), and causes the CLI to work
the same with regard to backslash escapes on both Windows and posix.

FossilOrigin-Name: bce807cd4876327396b4ffcdf77f6931dd3bbd3314336eedf38bcf01d17af32c

20 months agoJNI: improve UB protections in sqlite3_bind_blob/text/text16().
stephan [Sun, 22 Oct 2023 12:33:05 +0000 (12:33 +0000)] 
JNI: improve UB protections in sqlite3_bind_blob/text/text16().

FossilOrigin-Name: 5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97

20 months agoAdd missing ScalarFunction.java to JNI build.
stephan [Sun, 22 Oct 2023 11:11:54 +0000 (11:11 +0000)] 
Add missing ScalarFunction.java to JNI build.

FossilOrigin-Name: b8258103fb433d9f5cfa15661b5edf4e60128fb4161d8a18e5cc3253e5aed72b

20 months agoIn the CLI, do not translate unquoted backslash escapes on dot-commands
drh [Sat, 21 Oct 2023 22:31:00 +0000 (22:31 +0000)] 
In the CLI, do not translate unquoted backslash escapes on dot-commands
as that can damage filename arguments.

FossilOrigin-Name: 4a0e2c6e17eefb296b7e91a13305b2260d6eb869a37bc5e5b79edaf3c19c810a

20 months agoRemove a branch that cannot affect the outcome from FkNoAction processing in
drh [Sat, 21 Oct 2023 20:34:57 +0000 (20:34 +0000)] 
Remove a branch that cannot affect the outcome from FkNoAction processing in
fkey.c.  Replace it with an assert().

FossilOrigin-Name: 023a9dbe83c0042e9d500e3ae6c0592a468982e4ac278d08c9201967506c7555

20 months agoReplace the patch at [5cb61c6788d7c017] with a better way to avoid failing
drh [Sat, 21 Oct 2023 20:03:44 +0000 (20:03 +0000)] 
Replace the patch at [5cb61c6788d7c017] with a better way to avoid failing
PRAGMA integrity_check if a module implementation is not loaded, as the use
of suppressErr can lead to problems.

FossilOrigin-Name: be5737ee4f4f1d5f8b3126f6eb70210bf3d8b1cdaef51aae818eaaba43ccf722

20 months agoFix a problem allowing a COMMIT following an OOM to cause fts3/4 corruption.
dan [Sat, 21 Oct 2023 18:12:07 +0000 (18:12 +0000)] 
Fix a problem allowing a COMMIT following an OOM to cause fts3/4 corruption.

FossilOrigin-Name: 7f41d7006db4225cf9b3d197d3a76842778669ac079e76361214a8023c9976e6

20 months agoAdd the SQLITE_TESTCTRL_FK_NO_ACTION test control. Make it available in the
drh [Sat, 21 Oct 2023 16:33:20 +0000 (16:33 +0000)] 
Add the SQLITE_TESTCTRL_FK_NO_ACTION test control.  Make it available in the
CLI.  Fix a minor problems with SQLITE_CHANGESETAPPLY_FKNOACTION in sessions.

FossilOrigin-Name: 91b64c6a70744704fc3285be7d8d46ba679ea5f0f69bd77b0e093eeb7447947d

20 months agoExtra comment on the implementation of SQLITE_TESTCTRL_FK_NO_ACTION, fknoaction
drh [Sat, 21 Oct 2023 16:25:44 +0000 (16:25 +0000)] 
Extra comment on the implementation of SQLITE_TESTCTRL_FK_NO_ACTION,
warning about the need to reset the schema in order for the setting change
to take full effect.

FossilOrigin-Name: a50a333ae11ba5d92f432108308ac0bec9afb00f466b78c8d3f3aa7e2851ef21

20 months agoAdd missing "finish_test" to sessionnoact.test.
dan [Sat, 21 Oct 2023 15:21:06 +0000 (15:21 +0000)] 
Add missing "finish_test" to sessionnoact.test.

FossilOrigin-Name: 9a1d37f5479adedb93f40e8189ad0efa891a438805d80774ee992d4dfd71150f

20 months agoFix a problem with SQLITE_CHANGESETAPPLY_FKNOACTION and the foreign-key-trigger-cache.
dan [Sat, 21 Oct 2023 15:04:24 +0000 (15:04 +0000)] 
Fix a problem with SQLITE_CHANGESETAPPLY_FKNOACTION and the foreign-key-trigger-cache.

FossilOrigin-Name: 95304ec6c9654b4366dc58ae263270cb42861cb5017174936f816922b5eb61e6

20 months agoAdd SQLITE_TESTCTRL_FK_NO_ACTION.
drh [Sat, 21 Oct 2023 12:54:37 +0000 (12:54 +0000)] 
Add SQLITE_TESTCTRL_FK_NO_ACTION.

FossilOrigin-Name: 563cf5f782cdddbbd7f727c65118edfd109aeb731c8aaf0d6ee5ee7030e61ea9

20 months agoAdjust an EXPLAIN QUERY PLAN output in scanstatus2.test to account for a
drh [Sat, 21 Oct 2023 11:43:54 +0000 (11:43 +0000)] 
Adjust an EXPLAIN QUERY PLAN output in scanstatus2.test to account for a
different loop order taken due to the removal of the view-scan optimization.

FossilOrigin-Name: 9deb8b6915e794bf9c5de88f2727ef9857351eaf905f8ab56754bc4d399c88b4

20 months agoCompress the content of the status line in testrunning.tcl so that all the
drh [Sat, 21 Oct 2023 11:34:59 +0000 (11:34 +0000)] 
Compress the content of the status line in testrunning.tcl so that all the
same status information appears but with less punctuation and with "zero"
values omitted, so that the status line will fit comfortably on an 80-column
terminal window.

FossilOrigin-Name: 966351311682a319ec796c07d407ce90cd1aa0cea9e904ba1085a4ebadbdf925

20 months agoCreate the new string_agg(X,Y) aggregate function which is an alias for
drh [Sat, 21 Oct 2023 11:13:47 +0000 (11:13 +0000)] 
Create the new string_agg(X,Y) aggregate function which is an alias for
the two-argument group_concat(X,Y) function, for compatibility with
SQL-Server and PostgreSQL.

FossilOrigin-Name: a3b3df8a9e43f1880a904b76027db56ed504a84622831c96ba1962a19bbed762

20 months agoAvoid an unnecessary malloc() for the page usage bitmap when running
drh [Sat, 21 Oct 2023 11:06:03 +0000 (11:06 +0000)] 
Avoid an unnecessary malloc() for the page usage bitmap when running
a partial integrity_check.

FossilOrigin-Name: 2904fcbeebba9189cebc48e58d12fc46f78ee23d8c4d46644606691f8cabb80c

20 months agoFix a test case broken by the previous check-in. string_agg
drh [Sat, 21 Oct 2023 11:00:57 +0000 (11:00 +0000)] 
Fix a test case broken by the previous check-in.

FossilOrigin-Name: 1e61864c3bffec133632f4575d59d11936e8bafc089c4d84a129dcaf7e9b6d7d

20 months agoAdd string_agg(X,Y) as an alias for group_concat(X,Y), for compatibility
drh [Fri, 20 Oct 2023 20:19:30 +0000 (20:19 +0000)] 
Add string_agg(X,Y) as an alias for group_concat(X,Y), for compatibility
with SQLServer and PG.

FossilOrigin-Name: b91c19bf2680f60d7826ab5d9e7902e2dc2a55d847bbea565a6489d47f2cc8f1

20 months agoFix a problem allowing a COMMIT following an OOM to cause fts5 corruption.
dan [Fri, 20 Oct 2023 19:59:12 +0000 (19:59 +0000)] 
Fix a problem allowing a COMMIT following an OOM to cause fts5 corruption.

FossilOrigin-Name: fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e

20 months agoFix PRAGMA integrity_check so that it does not raise an error if the
drh [Fri, 20 Oct 2023 19:06:04 +0000 (19:06 +0000)] 
Fix PRAGMA integrity_check so that it does not raise an error if the
schema contains a CREATE VIRTUAL TABLE that does not have its module
loaded.

FossilOrigin-Name: 5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82

20 months agoOmit some redundant calls to strlen() used to find the size of
drh [Fri, 20 Oct 2023 18:09:08 +0000 (18:09 +0000)] 
Omit some redundant calls to strlen() used to find the size of
Expr.u.zToken in sqliteExprDup().  This inefficiency was seen while working
on the previous check-in, and I thought it best to fix it while it was
fresh in mind.

FossilOrigin-Name: b7a84eff5dcdf5b2ff81331097cdc64d0c5d16a4ae224320f39b64541ec72dc7

20 months agoImprovements to the sqlite3ExprDup() logic for faster performance and better
drh [Fri, 20 Oct 2023 17:15:15 +0000 (17:15 +0000)] 
Improvements to the sqlite3ExprDup() logic for faster performance and better
run-time error detection.  This check-in fixes the 5x oversize memory allocation
bug from [f371e4c0f8ea73ae] as well as all other known issues that result from
handing the ORDER BY clause of an aggregate function off of the pLeft pointer
of the Expr object.

FossilOrigin-Name: f5c01676fd281e938181b846dd2024d050f597dc6a7a91928beab9d8553dfdb5

20 months agoAdd the SQLITE_CHANGESETAPPLY_FKNOACTION flag to sqlite3session.h, for passing to...
dan [Fri, 20 Oct 2023 17:06:39 +0000 (17:06 +0000)] 
Add the SQLITE_CHANGESETAPPLY_FKNOACTION flag to sqlite3session.h, for passing to sqlite3changeset_apply_v2() to cause all foreign key constraints to behave as if they were declared NO ACTION.

FossilOrigin-Name: fc9f82ea084159eaf3dd1757b96d17d1201b00c4e06455a7dcd8067172b25f28

20 months agoSimplifications and optimizations to the Expr object duplication logic.
drh [Fri, 20 Oct 2023 15:47:30 +0000 (15:47 +0000)] 
Simplifications and optimizations to the Expr object duplication logic.
The 5x multiplier crutch from [f371e4c0f8ea73ae] is still present.  More
fixes are still needed.

FossilOrigin-Name: 56142a78163b755f16afc05201f623a7a19d9a4b0620a67f7fa20d2a965a288d

20 months agoOmit an unused constant from sessionfuzz.c to prevent a compiler warning.
drh [Fri, 20 Oct 2023 14:05:26 +0000 (14:05 +0000)] 
Omit an unused constant from sessionfuzz.c to prevent a compiler warning.

FossilOrigin-Name: a0cf7e24f928183866ac54f0d6cd83c859d487a19dc87572ab0188d90d2ff87d

20 months agoCorrect the opfs-sahpool VFS's xGetLastError() method to return the previous error...
stephan [Fri, 20 Oct 2023 12:23:49 +0000 (12:23 +0000)] 
Correct the opfs-sahpool VFS's xGetLastError() method to return the previous error code, not 0, on success.

FossilOrigin-Name: 95a1dde63117d696323c775580b9c04f044a5b8d609e9174b739ac03ecc1336c

20 months agoUse sqlite3ParserAddCleanup() instead of calling sqlite3ExprListDelete()
drh [Fri, 20 Oct 2023 10:18:03 +0000 (10:18 +0000)] 
Use sqlite3ParserAddCleanup() instead of calling sqlite3ExprListDelete()
directly when disposing of an unused ORDER BY in an aggregate function,
to avoid disrupting ALTER TABLE data structures.

FossilOrigin-Name: d083e42086733ecd79aba8c268e020b01782bfe1cfa9684ce1c277af9c8bf92a

20 months agoRemove a faulty assert() that was added just a few check-ins ago by
drh [Thu, 19 Oct 2023 20:06:20 +0000 (20:06 +0000)] 
Remove a faulty assert() that was added just a few check-ins ago by
[8b6fffb552c30f9c].

FossilOrigin-Name: 18e7c826f08bce51719ef045daa60200b33790f2fe312c6853f9ef6c7e9d5030

20 months agoFor TK_ORDER expression nodes to always be full-size.
drh [Thu, 19 Oct 2023 19:57:57 +0000 (19:57 +0000)] 
For TK_ORDER expression nodes to always be full-size.

FossilOrigin-Name: a5c73b46f4772f214ffbfa31cb87dce82ebd690addabef539bd09def26b7744d

20 months agoFix an adverse interaction between the new aggregate ORDER BY logic and the
drh [Thu, 19 Oct 2023 19:19:59 +0000 (19:19 +0000)] 
Fix an adverse interaction between the new aggregate ORDER BY logic and the
expression compressor.

FossilOrigin-Name: f371e4c0f8ea73aee9ea0645f396e3da20f1eb97be34c83de9d94c9cbb959934

20 months agoIn the TreeView logic (used for debugging only) do not show unnecessary fields
drh [Thu, 19 Oct 2023 19:08:33 +0000 (19:08 +0000)] 
In the TreeView logic (used for debugging only) do not show unnecessary fields
of the Window object when a function has a FILTER.

FossilOrigin-Name: d2c6b82c346dbf39e07f09d187e4a8216a56caa7df3dcfafc82e32f676a1db8a

20 months agoFix an fts3 problem caused by reducing the page size using the undocumented "nodesize...
dan [Thu, 19 Oct 2023 18:23:17 +0000 (18:23 +0000)] 
Fix an fts3 problem caused by reducing the page size using the undocumented "nodesize" option, then running an incremental-merge.

FossilOrigin-Name: 2875dcb1ac86db2704ad377d719f308c8837e196b49c98b20ceda1324f2d27ea

20 months agoSimplify the Expr compression logic slightly by adding the new EP_FullSize
drh [Thu, 19 Oct 2023 18:07:58 +0000 (18:07 +0000)] 
Simplify the Expr compression logic slightly by adding the new EP_FullSize
property to expressions that are exceptions to the rule and should not be
compressed.

FossilOrigin-Name: d5ae82ec52eafed5e3dc8c9d99685f6523fce7d973ef7e8d9d75ed9b8912426a

20 months agoSimplification to sqlite3GetVarint32() to avoid confusing gcov.
drh [Thu, 19 Oct 2023 13:35:22 +0000 (13:35 +0000)] 
Simplification to sqlite3GetVarint32() to avoid confusing gcov.

FossilOrigin-Name: 89862c51ad9715bedf5b029db484602e740f0db7404970d482ce503c1b9a0ed2

20 months agoFix an error in a debugging routine used inside of testcase(). Does not
drh [Thu, 19 Oct 2023 13:00:41 +0000 (13:00 +0000)] 
Fix an error in a debugging routine used inside of testcase().  Does not
appear in production.  Problem discovered by scan-build.

FossilOrigin-Name: c6c9d7ed6dbc71b998aeaaa1bdeb36b1bb9b902f9d6088ad36db29f8ea8b7ef6

20 months agoNew assert() statements to help verify correctness of the ORDER BY aggregate
drh [Thu, 19 Oct 2023 12:36:59 +0000 (12:36 +0000)] 
New assert() statements to help verify correctness of the ORDER BY aggregate
code.

FossilOrigin-Name: 8b6fffb552c30f9cbf7102c2e26a7b486c4c9edd9f494d803de7004db3018277

20 months agoFix the sqlite3ReferencesSrcList() routine so that it recognizes columns
drh [Thu, 19 Oct 2023 12:12:49 +0000 (12:12 +0000)] 
Fix the sqlite3ReferencesSrcList() routine so that it recognizes columns
in the ORDER BY clause of an aggregate.  Fixes a problem with
[634286828dad873d] discoverd by dbsqlfuzz.

FossilOrigin-Name: 3d26f1aaa4876f21f2c3abf13bbc37933c8f32471153e29019880cc9530cb011

20 months agoAdd support for ORDER BY on the argument list of aggregate functions.
drh [Thu, 19 Oct 2023 01:26:34 +0000 (01:26 +0000)] 
Add support for ORDER BY on the argument list of aggregate functions.

FossilOrigin-Name: 634286828dad873dba244751441aa729cd37b6ed5899fa5875643d4af03c006c

20 months agoMerge the latest changes from trunk. agg-orderby
drh [Thu, 19 Oct 2023 01:09:49 +0000 (01:09 +0000)] 
Merge the latest changes from trunk.

FossilOrigin-Name: d18bc400146812c8c5048af7eaf4a5371ddd80fc9ce895d253b6114b9eae7fc3

20 months agoFix a false-positive in run-time error checking.
drh [Thu, 19 Oct 2023 00:25:35 +0000 (00:25 +0000)] 
Fix a false-positive in run-time error checking.

FossilOrigin-Name: cd63eec0758960d9ee63d7b964ec62e2bd622f8c94a58bd9556046381ffa18d0

20 months agoChanges for test coverage.
drh [Wed, 18 Oct 2023 23:48:24 +0000 (23:48 +0000)] 
Changes for test coverage.

FossilOrigin-Name: ddfa09c6031afd4391a9888381bf09214cd542a826b431eeb1537a070f65c5f9

20 months agoTest case for alter column that is used in the ORDER BY of an aggregate.
drh [Wed, 18 Oct 2023 22:53:22 +0000 (22:53 +0000)] 
Test case for alter column that is used in the ORDER BY of an aggregate.

FossilOrigin-Name: 648ddb3a8eb358fc6c95aaa561ae68476c77996abda23890054ac07166278cef

20 months agoDeal with an OOM condition while processing aggregate ORDER BYs.
drh [Wed, 18 Oct 2023 22:27:59 +0000 (22:27 +0000)] 
Deal with an OOM condition while processing aggregate ORDER BYs.

FossilOrigin-Name: b6d44427ec0184880ad14919667e2f526777c5085ffa636f6734cb5951a31225

20 months agoMake sure all terms of the ORDER BY within an aggregate go through aggregate
drh [Wed, 18 Oct 2023 22:03:48 +0000 (22:03 +0000)] 
Make sure all terms of the ORDER BY within an aggregate go through aggregate
analysis.  Do not attach an aggregate ORDER BY to a window function.

FossilOrigin-Name: 16f3805514a741405f70e0ee3b5a6b67720bc75719372e82daa4136fe411ea2b

20 months agoBasic test cases.
drh [Wed, 18 Oct 2023 19:44:59 +0000 (19:44 +0000)] 
Basic test cases.

FossilOrigin-Name: 6cccf86c362631ada0c6cbaf661520648f8bbf7ae2b137b3d7d959647387e5c2

20 months agoFix one minor error in order to get all legacy tests to pass.
drh [Wed, 18 Oct 2023 19:07:45 +0000 (19:07 +0000)] 
Fix one minor error in order to get all legacy tests to pass.

FossilOrigin-Name: 5a885139c433a143302ab43dc5aaac1fed9db61548b4ff7d4b19b3a6a46c8fcc

20 months agoORDER BY on aggregates seem to work, at least for simple smoke tests. Lots
drh [Wed, 18 Oct 2023 18:11:11 +0000 (18:11 +0000)] 
ORDER BY on aggregates seem to work, at least for simple smoke tests.  Lots
more testing is needed though.  Surely there are many bugs.

FossilOrigin-Name: 64c12a835b6f1df8f2f5f4a41de083f6b3fc7f8030042c6aac0082382cd9cc4d

20 months agoBasic error checking. Resolve symbols in the aggregate ORDER BY expressions.
drh [Wed, 18 Oct 2023 13:58:31 +0000 (13:58 +0000)] 
Basic error checking.  Resolve symbols in the aggregate ORDER BY expressions.

FossilOrigin-Name: c83a53a574d312130d1238c05ffa449d8bed2535d5ef5b5d9cf02f894494cca4

20 months agoEnhance the parser so that it can accept an ORDER BY clause on a function
drh [Wed, 18 Oct 2023 13:18:52 +0000 (13:18 +0000)] 
Enhance the parser so that it can accept an ORDER BY clause on a function
invocation.  For this incremental check-in, the ORDER BY clause is currently
ignored.

FossilOrigin-Name: 3a98ff24bf468ed42d410a9a12d9f9b2ca154c7babe99fd6bc6f7b0565e0d132

20 months agoJS: replace one errant reference to 'self' with 'globalThis' and remove a separate...
stephan [Tue, 17 Oct 2023 23:35:47 +0000 (23:35 +0000)] 
JS: replace one errant reference to 'self' with 'globalThis' and remove a separate dead-code 'self' reference.

FossilOrigin-Name: da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31

20 months agoFix a harmless compiler warning about variant types for a pointer function.
drh [Tue, 17 Oct 2023 19:33:52 +0000 (19:33 +0000)] 
Fix a harmless compiler warning about variant types for a pointer function.

FossilOrigin-Name: 37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289

20 months agoMake a new branch in the SqlExec opcode reachable by tests.
drh [Tue, 17 Oct 2023 18:59:13 +0000 (18:59 +0000)] 
Make a new branch in the SqlExec opcode reachable by tests.

FossilOrigin-Name: 023ad470b68b7c09e159244493a6d0285d706efdecd8719a71e6885509d4750c

20 months agoOmit an unreachable branch when SQLITE_ENABLE_API_ARMOR is not defined.
drh [Tue, 17 Oct 2023 18:28:27 +0000 (18:28 +0000)] 
Omit an unreachable branch when SQLITE_ENABLE_API_ARMOR is not defined.

FossilOrigin-Name: 5f8b807b568f4f9ec65f1c924e0e1ac2f996f405e045204145ad7116be7580ee

20 months agoChanges to sqlite3IntFloatCompare() in an attempt to better measure
drh [Tue, 17 Oct 2023 17:53:46 +0000 (17:53 +0000)] 
Changes to sqlite3IntFloatCompare() in an attempt to better measure
branch coverage in the face of aggressive compiler optimization.

FossilOrigin-Name: 5781d043ffeccda03357ee530564987443dc1deb6111a4028701b4a98fdfe16d

20 months agoFix a JSON bug introduced by the optimization of [df099ad713011b67] and
drh [Tue, 17 Oct 2023 13:41:41 +0000 (13:41 +0000)] 
Fix a JSON bug introduced by the optimization of [df099ad713011b67] and
first appearing in 3.43.0.  The problem occurs when doing a JSON_EXTRACT()
on an array element that was added by JSON_SET() without first reparsing.
Reported by [forum:/forumpost/fc0e3f1e2a|forum post fc0e3f1e2a].

FossilOrigin-Name: e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58

20 months agoEnhance the documentation of sqlite3_deserialize() to make it clear that
drh [Tue, 17 Oct 2023 11:57:36 +0000 (11:57 +0000)] 
Enhance the documentation of sqlite3_deserialize() to make it clear that
the input database may not be in WAL mode.
[forum:/forumpost/a7e272cee9ac469f|Forum post a7e272cee9ac469f]

FossilOrigin-Name: e754789971e019647e7068f76dc6f9778675e4849fe51d8b25b39d3edf2379e5

20 months agoWhen an I/O or similar error occurs during a transaction with
drh [Tue, 17 Oct 2023 10:47:42 +0000 (10:47 +0000)] 
When an I/O or similar error occurs during a transaction with
journal_mode=MEMORY, attempt to rollback before closing the journal, as
all rollback information is forgotten when a memory rollback journal is
closed.

FossilOrigin-Name: 1d67f75de259e5a26b751a50432822a268ebe367cda6510891ab81a15e5daa1c

20 months agoHarden API_ARMOR checks for sqlite3_stmt_scanstatus_v2().
stephan [Tue, 17 Oct 2023 02:15:49 +0000 (02:15 +0000)] 
Harden API_ARMOR checks for sqlite3_stmt_scanstatus_v2().

FossilOrigin-Name: d3f38e813ba3b887e973af034713cd58fdfbe07da375b154accc7b5790cfaeda

20 months agoJNI: add aggregate function support to the wrapper1 API.
stephan [Mon, 16 Oct 2023 16:04:23 +0000 (16:04 +0000)] 
JNI: add aggregate function support to the wrapper1 API.

FossilOrigin-Name: 15b28b340a5c5efdbfe3fbed16ee0b699561edaeebb77446addf2374bdf9357e

20 months agoJNI: add scalar UDF support to the wrapper1 API.
stephan [Mon, 16 Oct 2023 14:31:13 +0000 (14:31 +0000)] 
JNI: add scalar UDF support to the wrapper1 API.

FossilOrigin-Name: a850535766d2243d9475e1523c753615875a2da9c9d82a41a9fb61b141c6334a

20 months agoJNI: initial draft (untested - requires more infrastructure first) of a UDF argument...
stephan [Mon, 16 Oct 2023 13:04:42 +0000 (13:04 +0000)] 
JNI: initial draft (untested - requires more infrastructure first) of a UDF argument/result-handling interface which completely hides the C-style API from the client.

FossilOrigin-Name: 43b10a5cf9cb8be53d62914f340d533e60a70bf4caa8b9b91c0f867fa0f70493

20 months agoJNI: cleanups in Tester2 and update the jar makefile target to account for [9fcdf96ad...
stephan [Mon, 16 Oct 2023 10:38:34 +0000 (10:38 +0000)] 
JNI: cleanups in Tester2 and update the jar makefile target to account for [9fcdf96adca2].

FossilOrigin-Name: abc82bf4b800dde1b6e6172c7be816edb391fdbed5dbd2749f54623fdf3bf8e6

20 months agoJNI: move the C-style API parts into the capi subpackage and the higher-level wrapper...
stephan [Mon, 16 Oct 2023 10:27:19 +0000 (10:27 +0000)] 
JNI: move the C-style API parts into the capi subpackage and the higher-level wrapper into (tentatively) wrapper1, so that CApi.java can support multiple independent higher-level wrappers without name collisions, and CApi can be made public but have the option to be elided from wrapper-level javadocs for wrappers which do not wish to expose it.

FossilOrigin-Name: 9fcdf96adca25cc2d2f4b75ec4eea94254fb9671c5ba63b88213d7f62dedff1b

20 months agoJNI: after calling a Java-side UDF, zero-out the pointer of the Java-side sqlite3_con...
stephan [Mon, 16 Oct 2023 08:10:11 +0000 (08:10 +0000)] 
JNI: after calling a Java-side UDF, zero-out the pointer of the Java-side sqlite3_context and sqlite3_value array entries to avoid misbehavior if a client makes the mistake of holding a reference to one of those objects.

FossilOrigin-Name: 9fc3104f76a83d600beb11d91feb97bcea8bc7f7cda8cd73e7a6b81fbba879df

20 months agoJNI: do not expose SQLITE_OPEN_... flags which are specific to VFSes.
stephan [Mon, 16 Oct 2023 08:05:51 +0000 (08:05 +0000)] 
JNI: do not expose SQLITE_OPEN_... flags which are specific to VFSes.

FossilOrigin-Name: 2b4e53d8be42a3bc098317abd8bb58b8ddc25094d80787f784bbc896f4f7b976

20 months agoChange 3 instance of #if SQLITE_ENABLE_API_ARMOR to #ifdef for consistency with how...
stephan [Sun, 15 Oct 2023 13:36:21 +0000 (13:36 +0000)] 
Change 3 instance of #if SQLITE_ENABLE_API_ARMOR to #ifdef for consistency with how it is normally used.

FossilOrigin-Name: dd766eeb59fec71627dd8ad8f120875b96fda455c6401e5671e086b785e2b2bc

20 months agoJNI: enable all optional components in the default build and fix a test broken by...
stephan [Sun, 15 Oct 2023 13:32:38 +0000 (13:32 +0000)] 
JNI: enable all optional components in the default build and fix a test broken by an option toggle.

FossilOrigin-Name: 5586a9df58a400c20a6815e8b0fbc7a7c49e5ef89daf92c452f1990586ca78ae

20 months agoCorrect non-void return from sqlite3_preupdate_hook() when API_ARMOR is enabled....
stephan [Sun, 15 Oct 2023 13:25:39 +0000 (13:25 +0000)] 
Correct non-void return from sqlite3_preupdate_hook() when API_ARMOR is enabled. Broken by [6cb77503484e].

FossilOrigin-Name: 40f5906f48d3f1f44d54e5b271fe04e7082166e50e3ed250bb57a4760f112e8a

20 months agoAdd coverage of more functions to SQLITE_ENABLE_API_ARMOR builds.
stephan [Sun, 15 Oct 2023 12:11:10 +0000 (12:11 +0000)] 
Add coverage of more functions to SQLITE_ENABLE_API_ARMOR builds.

FossilOrigin-Name: 6cb77503484e104a51f08690974d6e19c336ab5467d327f84be1d042615f008c

20 months agoJNI: extend [baf220e78a46246c47] to include macro-generated sqlite3_value_...() bindings. api-armor-audit
stephan [Sat, 14 Oct 2023 20:44:13 +0000 (20:44 +0000)] 
JNI: extend [baf220e78a46246c47] to include macro-generated sqlite3_value_...() bindings.

FossilOrigin-Name: ad34b2542e330c22fcf331810ab43e66346b1bad8de1a3989e6208cfa0fc2f92

20 months agoJNI: make the sqlite3_value_...() family of bindings resistent to NULL arguments.
stephan [Sat, 14 Oct 2023 20:34:40 +0000 (20:34 +0000)] 
JNI: make the sqlite3_value_...() family of bindings resistent to NULL arguments.

FossilOrigin-Name: baf220e78a46246c476cd429ac131698db5fa66f62fb5725d4f736fe5246283c

20 months agoDo not allow an ALTER TABLE ADD COLUMN on a STRICT table if the added column
drh [Sat, 14 Oct 2023 20:24:52 +0000 (20:24 +0000)] 
Do not allow an ALTER TABLE ADD COLUMN on a STRICT table if the added column
contains a DEFAULT clause that would violate the type of the added column.

FossilOrigin-Name: 75b075863eaa56e36635a1d27740d37de8600ba92099b3fad9378a1e6ce12c0e

20 months agoAdd API_ARMOR support to the scanstatus family of functions.
stephan [Sat, 14 Oct 2023 20:01:55 +0000 (20:01 +0000)] 
Add API_ARMOR support to the scanstatus family of functions.

FossilOrigin-Name: 2f3101f016d5f8d954a262befdf5e0f938a223e444bc534e1d3655b733f4663d

20 months agoThe rtreecheck() SQL function should not invoke BEGIN or COMMIT as this
drh [Sat, 14 Oct 2023 17:14:53 +0000 (17:14 +0000)] 
The rtreecheck() SQL function should not invoke BEGIN or COMMIT as this
causes issues for statement transactions.

FossilOrigin-Name: b7b2e30b570efda338c62e88446dedb6667640f33855b2422ad20c7b569b025a

20 months agoJNI: add a missing result code check to sqlite3_bind_value(stmt, null).
stephan [Sat, 14 Oct 2023 16:57:48 +0000 (16:57 +0000)] 
JNI: add a missing result code check to sqlite3_bind_value(stmt, null).

FossilOrigin-Name: f1a357f42de58927c33e7047dc4417e3b9549d7529625f30c583e66b7d603b00

20 months agoJNI: add missing sqlite3_bind_value() and minor memory-safety-related cleanups.
stephan [Sat, 14 Oct 2023 16:56:12 +0000 (16:56 +0000)] 
JNI: add missing sqlite3_bind_value() and minor memory-safety-related cleanups.

FossilOrigin-Name: 3900031763abf4b2aab7b57e886cc407571d0d5928b74f24dcea8fb7371655af

20 months agoAdd API_ARMOR support to the sqlite3_result_...() family of functions and sqlite3_bin...
stephan [Sat, 14 Oct 2023 16:29:36 +0000 (16:29 +0000)] 
Add API_ARMOR support to the sqlite3_result_...() family of functions and sqlite3_bind_zeroblob64().

FossilOrigin-Name: afabe3e35a66625527e2881749cdb6e13300888ab57bc0f05889d0e3ee203d73

20 months agoMore API_ARMOR additions.
stephan [Sat, 14 Oct 2023 14:53:18 +0000 (14:53 +0000)] 
More API_ARMOR additions.

FossilOrigin-Name: 78ebf838f645742f87733665cd72af736df345683b27377a2c8310c893b1769d

20 months agoAdd column name to API_ARMOR check in sqlite3_blob_open() to avoid a null-pointer...
stephan [Sat, 14 Oct 2023 13:24:30 +0000 (13:24 +0000)] 
Add column name to API_ARMOR check in sqlite3_blob_open() to avoid a null-pointer deref.

FossilOrigin-Name: 0114a6622afc4588c47e98d804340449417b603dc4831513eab4d8e4ccb15d42

20 months agoRevert [f6cd88e6b234] - the NULL callback case is perfectly legal.
stephan [Sat, 14 Oct 2023 12:45:11 +0000 (12:45 +0000)] 
Revert [f6cd88e6b234] - the NULL callback case is perfectly legal.

FossilOrigin-Name: 718ab67607895176e529eb7469832d262a347d030e83e7ee66d3b4704bf933de

20 months agoBring JNI-side sqlite3_last_insert_rowid() and sqlite3_table_column_metadata() in...
stephan [Sat, 14 Oct 2023 12:40:57 +0000 (12:40 +0000)] 
Bring JNI-side sqlite3_last_insert_rowid() and sqlite3_table_column_metadata() in line with the core's NULL handling.

FossilOrigin-Name: c2afc1c2a2fc9bdf3d7b7701004e0fa40965cf8c6b7cf44b46f2ca37cfa1d2aa

20 months agoExtend API_ARMOR checks on sqlite3_commit/rollback_hook() to include a check for...
stephan [Sat, 14 Oct 2023 12:20:55 +0000 (12:20 +0000)] 
Extend API_ARMOR checks on sqlite3_commit/rollback_hook() to include a check for the callback pointer.

FossilOrigin-Name: f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d