]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoMerge the latest trunk enhancements into the begin-concurrent-report branch. begin-concurrent-report
drh [Wed, 21 Dec 2022 20:17:13 +0000 (20:17 +0000)] 
Merge the latest trunk enhancements into the begin-concurrent-report branch.

FossilOrigin-Name: 397fb07bb4bc404d7c44f01e18811ecf2f84d22601f14363e442e8fe63f64b7b

2 years agoUpdate the begin-concurrent branch with the latest enhancements on trunk.
drh [Wed, 21 Dec 2022 20:07:58 +0000 (20:07 +0000)] 
Update the begin-concurrent branch with the latest enhancements on trunk.

FossilOrigin-Name: 0c198aee53d35cf0999f880c433140c3dfc6bd620c30920b08d7534c0f905e05

2 years agoMore efficient implementation of large precisions on the "%c" format for
drh [Wed, 21 Dec 2022 19:11:56 +0000 (19:11 +0000)] 
More efficient implementation of large precisions on the "%c" format for
the built-in printf().  This is an effort to avoid a reported
timeout on a (ridiculous) query generated by OSSFuzz.

FossilOrigin-Name: 371f9b88387a44a5f820279d79733d1deb7eafc72f320ec47a11679bbdbb49ef

2 years agoEnsure that the expression of a virtual column really is an expression and
drh [Wed, 21 Dec 2022 14:13:49 +0000 (14:13 +0000)] 
Ensure that the expression of a virtual column really is an expression and
not just a reference to another column, as a real expression is necessary for
the indexed expression coverage optimization to work properly.
[forum:/forumpost/07b36e3899a9ae21|Forum thread 07b36e3899a9ae21].

FossilOrigin-Name: 40549bacb3923e439627b0103bedd7da30258b69a46960040f7176e060f51f2f

2 years agoNew WHERETRACE entries for adding and removing objects from the
drh [Wed, 21 Dec 2022 12:18:06 +0000 (12:18 +0000)] 
New WHERETRACE entries for adding and removing objects from the
Parse.pIdxEpr list as part of indexed expression coverage.  Debug and
testing changes only - no affect on production builds.

FossilOrigin-Name: 4dc438a951bdbe27fbd5ee7cfb907e30ec0efbf8ce02109f18997cc221e0ad3b

2 years agoAdd about 150 new fuzzer cases to test/fuzzdata8.db.
drh [Tue, 20 Dec 2022 15:22:57 +0000 (15:22 +0000)] 
Add about 150 new fuzzer cases to test/fuzzdata8.db.

FossilOrigin-Name: a8d8d9cd65e64e0a492a80c00050f54ab75de82651230049f65c9d2b78a164f2

2 years agoAdd ALWAYS() to always-true branches in the locking logic of the memdb VFS.
drh [Tue, 20 Dec 2022 15:02:44 +0000 (15:02 +0000)] 
Add ALWAYS() to always-true branches in the locking logic of the memdb VFS.

FossilOrigin-Name: 01fa760212a40cec5b43da99b917ab6389561c96d0567a9f67f516bdfa8f5f3d

2 years agoImprovement to the dbsqlfuzz fix of [f113eebdbe68246f].
drh [Tue, 20 Dec 2022 14:02:35 +0000 (14:02 +0000)] 
Improvement to the dbsqlfuzz fix of [f113eebdbe68246f].

FossilOrigin-Name: 79d62956f206cb2987891d4ba5985cece21fc8c8c1158f46c2951f65c0dcf4e8

2 years agoDo not use indexed expressions to replace the expression being indexed on a
drh [Tue, 20 Dec 2022 01:48:43 +0000 (01:48 +0000)] 
Do not use indexed expressions to replace the expression being indexed on a
RIGHT JOIN as that leads to problems, as shown by
dbsqlfuzz a644e70d7683a7ca59c71861a153c1dccf8850b9.

FossilOrigin-Name: f113eebdbe68246fd38d640b0cdf0fd73ab5d2abad9226274dfa2e41fe286bf0

2 years agoFix a faulty assert() in fts5.
dan [Mon, 19 Dec 2022 20:14:22 +0000 (20:14 +0000)] 
Fix a faulty assert() in fts5.

FossilOrigin-Name: 569018170b928cadfa0745db631981084e595d90a8c3d1e236c42adae161018f

2 years agoRemove an unused variable.
drh [Mon, 19 Dec 2022 19:04:32 +0000 (19:04 +0000)] 
Remove an unused variable.

FossilOrigin-Name: 5c4d94147d290d4a68ac0d5ae8f9e6bbfe7522ad58b2298e387f8c699048e111

2 years agoMinor sed script tweak in the wasm GNUmakefile for BSD portability, as reported in...
stephan [Mon, 19 Dec 2022 14:46:17 +0000 (14:46 +0000)] 
Minor sed script tweak in the wasm GNUmakefile for BSD portability, as reported in [forum:4a97813fcbd4f63e|forum post 4a97813fcbd4f63e].

FossilOrigin-Name: 49efcf6d9f894c28a3ffb350a7c5f0ffd12c7cbf61f5c27f76eb7f777b8a24c5

2 years agoUpdate test-opfs-vfs.js to account for recent API changes. Reported in [forum:4a97813...
stephan [Mon, 19 Dec 2022 14:43:17 +0000 (14:43 +0000)] 
Update test-opfs-vfs.js to account for recent API changes. Reported in [forum:4a97813fcbd4f63e|forum post 4a97813fcbd4f63e].

FossilOrigin-Name: 2a636746360c109f1d39fc352b9f1c83a739735520252a264c774e848597475d

2 years agoFix an assert() in fts5. Simplify memdb xLock/xUnlock some.
dan [Mon, 19 Dec 2022 14:06:36 +0000 (14:06 +0000)] 
Fix an assert() in fts5. Simplify memdb xLock/xUnlock some.

FossilOrigin-Name: 7fe158aa8071acadd959b2b4a4b66e8a7f7eecec207ba681abf516b0457c2921

2 years agoFix a minor problem with the printAggInfo() routine (used on during
drh [Mon, 19 Dec 2022 12:25:41 +0000 (12:25 +0000)] 
Fix a minor problem with the printAggInfo() routine (used on during
debugging).

FossilOrigin-Name: c8329967f32efedfc8244631a5682f7f7d21c1b3fcd7d5cc67716555716d4926

2 years agoJS namespace updates in ext/wasm/api/README.md.
stephan [Sun, 18 Dec 2022 12:00:10 +0000 (12:00 +0000)] 
JS namespace updates in ext/wasm/api/README.md.

FossilOrigin-Name: ca59e736b1839c30a820dd5795b4534e1565387ef701423451ea4c503a9701ea

2 years agoFix an unnecessarily restrictive assert() in the aggregate logic.
drh [Sat, 17 Dec 2022 22:10:05 +0000 (22:10 +0000)] 
Fix an unnecessarily restrictive assert() in the aggregate logic.
dbsqlfuzz 699bee2aa26c5dc84afabf6894685c316d936485

FossilOrigin-Name: 8cc0af81ad03ac65f230d78cf97e1448c2d93d556467ea3ef700d5abd4a3890c

2 years agoRemove slew of inadvertant tabs in favor of spaces.
larrybr [Sat, 17 Dec 2022 19:56:28 +0000 (19:56 +0000)] 
Remove slew of inadvertant tabs in favor of spaces.

FossilOrigin-Name: 0aa6da69e12e483b5561bb9a054ec27a99f51772340c950783e342e6dd39beb9

2 years agoAdd NEVER/ALWAYS to branches that have become unreachable due to recent
drh [Sat, 17 Dec 2022 12:49:04 +0000 (12:49 +0000)] 
Add NEVER/ALWAYS to branches that have become unreachable due to recent
enhancements.

FossilOrigin-Name: b4281db4e4762773684d27b809ef911da08b81cb953b3666e535b990d4d5f701

2 years agoUpdate wasmfs.make to get WASMFS building again, but changes made to OPFS-over-WASMFS...
stephan [Sat, 17 Dec 2022 11:14:35 +0000 (11:14 +0000)] 
Update wasmfs.make to get WASMFS building again, but changes made to OPFS-over-WASMFS since we last tested it have made it incompatible with how we used it. It can now only be used from worker threads, eliminating the one benefit it had over the sqlite3_vfs OPFS implementation. Remove/amend references to WASMFS in the docs and remove all WASMFS-specific test app links from index.html.

FossilOrigin-Name: 32dc98c8001387b1970623192ec6cb89445000fa49bda5f4bd7c525bbe20bb5b

2 years agoDisallow some of the query invariant tests on SQL statements that contain
drh [Fri, 16 Dec 2022 18:32:07 +0000 (18:32 +0000)] 
Disallow some of the query invariant tests on SQL statements that contain
a GROUP BY since output terms that are no covered by the GROUP BY are
indeterminant.

FossilOrigin-Name: 28ba1fec4519e7ca9466f1a2f787c905f2cf880d38a004639f99f948e46a51e7

2 years agoExpose a JS-friendly subset of sqlite3_config() to JS, with the notable caveats that...
stephan [Fri, 16 Dec 2022 13:04:21 +0000 (13:04 +0000)] 
Expose a JS-friendly subset of sqlite3_config() to JS, with the notable caveats that (1) setting up the JS bindings requires starting the library, making sqlite3_config() illegal to call and (2) calling sqlite3_shutdown() in order to make it legal to call sqlite3_config() may undo certain JS-side library initialization. Move sqlite3_(de)serialize() into the int64-mode-only bindings because of their int64 args.

FossilOrigin-Name: 62e0c931ac952219f68e22d64e20836781bf330b4581e4662266172a97c9289b

2 years agoIn the fuzzer invariant checker, do not add new WHERE clause terms that
drh [Fri, 16 Dec 2022 12:07:48 +0000 (12:07 +0000)] 
In the fuzzer invariant checker, do not add new WHERE clause terms that
make use of an ambiguous column name.

FossilOrigin-Name: d5b46541c30bcbeb7e57b5b5951856d564e81f7f9638d66d205157797964418c

2 years agoAdd a test confirming that exceptions are not passed through C-space if a JS-side...
stephan [Fri, 16 Dec 2022 11:33:42 +0000 (11:33 +0000)] 
Add a test confirming that exceptions are not passed through C-space if a JS-side sqlite3_set_authorizer() callback throws.

FossilOrigin-Name: 5a77c2c7aaa556007274e1b85790934665c2c12661ca11d896eb7d09cd49ce72

2 years agoAdd sqlite3_set_authorizer() support and related tests to JS.
stephan [Fri, 16 Dec 2022 11:13:32 +0000 (11:13 +0000)] 
Add sqlite3_set_authorizer() support and related tests to JS.

FossilOrigin-Name: 551b848894c249cb3c9d237643d2ed53ffcb3b003d0cf3f797a535df1731ce39

2 years agoCreate a new affinity called FLEXNUM that works like NUMERIC except that it
drh [Thu, 15 Dec 2022 20:03:08 +0000 (20:03 +0000)] 
Create a new affinity called FLEXNUM that works like NUMERIC except that it
never tries to convert integer to real or real to integer.  The affinity is
only used internally - it is not possible to create a table column with this
affinity.  This affinity is used on subqueries and views that are built off
of a compound SELECT and where the datatype is controlled by a CAST expression.
dbsqlfuzz c9ee6f9a0a8b8fefb02cf69de2a8b67ca39525c8

FossilOrigin-Name: 44135d6ea84f7ba6b36549954b38a8bc048d5ffea5a9779e35950afa4eb2dfb2

2 years agoFix an incompatibility between the Tcl interface and the "memdb" vfs by allowing...
dan [Thu, 15 Dec 2022 18:56:12 +0000 (18:56 +0000)] 
Fix an incompatibility between the Tcl interface and the "memdb" vfs by allowing memdb to accept filenames that begin with '\' characters.

FossilOrigin-Name: bd537f2057a4800bd30e7dd57405c3e57df649471104c80bd32573a89568029e

2 years agoAdded a couple missing 'not part of the public API' tags on functions in sqlite3...
stephan [Thu, 15 Dec 2022 18:50:30 +0000 (18:50 +0000)] 
Added a couple missing 'not part of the public API' tags on functions in sqlite3-wasm.c. No code changes.

FossilOrigin-Name: eb27feecea508f3491a09699f2339951facd2345d479cfd3020183dc2af703b2

2 years agoOmit the columnTypeImpl() function from the build when SQLITE_OMIT_DECLTYPE
drh [Thu, 15 Dec 2022 15:37:52 +0000 (15:37 +0000)] 
Omit the columnTypeImpl() function from the build when SQLITE_OMIT_DECLTYPE
is defined, because it is no longer used in that case.

FossilOrigin-Name: 751e344f4cd2045caf97920cc9f4571caf0de1ba83b94ded902a03b36c10a389

2 years agoFix harmless compiler warnings.
drh [Thu, 15 Dec 2022 13:45:49 +0000 (13:45 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: ddb260cc52efce6472b9423cbc6b788d8c38746f1842c9f1c184c08c651b3387

2 years agoUpdate a test case in scanstatus2.test to account for recent planner enhancements.
dan [Thu, 15 Dec 2022 11:39:12 +0000 (11:39 +0000)] 
Update a test case in scanstatus2.test to account for recent planner enhancements.

FossilOrigin-Name: 53e07dc6b6521bb7757d0bc2cf12a501bb929afafdb16737058496afca8e6742

2 years agoFix an unsafe use of sqlite3_mprintf() in sqlite3_overload_function() identified...
dan [Thu, 15 Dec 2022 11:31:11 +0000 (11:31 +0000)] 
Fix an unsafe use of sqlite3_mprintf() in sqlite3_overload_function() identified by forum post: <https://sqlite.org/forum/forumpost/95b338860d>.

FossilOrigin-Name: 9fa2b94c2e0fd43c1a9c15a79fe1325afa1699f0685dcd039024a80185cc5658

2 years agoInternal refactoring of how sqlite3.wasm.xWrap() handles JS-to-C function pointer...
stephan [Thu, 15 Dec 2022 02:28:55 +0000 (02:28 +0000)] 
Internal refactoring of how sqlite3.wasm.xWrap() handles JS-to-C function pointer conversions, to enable similar conversions to be added more easily.

FossilOrigin-Name: 10cfe3fae6f680d3ecc3b0afbbf628ce91e34e3757b19dd27c231f0daf44232a

2 years agoRemove an unnecessary/obsolete Emscripten-specific export.
stephan [Thu, 15 Dec 2022 02:26:13 +0000 (02:26 +0000)] 
Remove an unnecessary/obsolete Emscripten-specific export.

FossilOrigin-Name: fa278022afd6dd6e499d26f74a8359f3e9973e1680772059ce331b64e77ec582

2 years agoFix minor problems in the new sqlite3ExprDataType() function.
drh [Wed, 14 Dec 2022 23:53:29 +0000 (23:53 +0000)] 
Fix minor problems in the new sqlite3ExprDataType() function.

FossilOrigin-Name: c1d5261b222bbf94c20e558089f3d2eae6a88b6d739225ee4f7d0338e0e59994

2 years agoAdjust the query planner to be more aggressive about using co-routines rather
drh [Wed, 14 Dec 2022 18:34:05 +0000 (18:34 +0000)] 
Adjust the query planner to be more aggressive about using co-routines rather
than materializing subqueries and views.  Implementation of enhancement
request [73ebbb3a3d1a7bd3].

FossilOrigin-Name: 0b58d1b354a0f91bafeafee102acedd4654dc420afdf4eb4aaac9bf5bcb63c1f

2 years agoRename the new peek/pokeF32() and peek/pokeF64() to peek/poke32f() and peek/poke64f...
stephan [Wed, 14 Dec 2022 18:06:01 +0000 (18:06 +0000)] 
Rename the new peek/pokeF32() and peek/pokeF64() to peek/poke32f() and peek/poke64f() for consistency with related APIs and because they're easier on both the eyes and the fingers.

FossilOrigin-Name: cc86f03ed698a071cd02ef3dfaba69092226bff20c917d662f808061627ad285

2 years agoMerge all the latest trunk enhancements into the coroutines-exp2 enhancement coroutines-exp2
drh [Wed, 14 Dec 2022 17:52:15 +0000 (17:52 +0000)] 
Merge all the latest trunk enhancements into the coroutines-exp2 enhancement
branch.

FossilOrigin-Name: ea278438b72e85d217e72c836cbefd68bd8b336baf33507b2d8d12ef436424cd

2 years agoRework the code that computes the datatypes and affinities for subqueries
drh [Wed, 14 Dec 2022 17:46:35 +0000 (17:46 +0000)] 
Rework the code that computes the datatypes and affinities for subqueries
and views.  If the subquery/view is constructed from a compound SELECT where
the affinity varies across arms of the compound, set the affinity for the
corresponding column in the constructed view to be BLOB so that it is allowed
to take on any data type.

FossilOrigin-Name: 27655c9353620aa58105e87d1e171d1f0a637deedde41c081824078385cd49ac

2 years agoSlight reformulation of some test code to test multi-arg wasm.peek() call form.
stephan [Wed, 14 Dec 2022 16:40:17 +0000 (16:40 +0000)] 
Slight reformulation of some test code to test multi-arg wasm.peek() call form.

FossilOrigin-Name: 349bb28f614bc210b3283ed1c1144c45fbc7d9e2ffc3dc6193ccb9932d347efb

2 years agoIf the SELECT that implements a subquery or a VIEW or a CREATE TABLE AS is refactor-subquery-types
drh [Wed, 14 Dec 2022 14:41:35 +0000 (14:41 +0000)] 
If the SELECT that implements a subquery or a VIEW or a CREATE TABLE AS is
a compound with different result datatypes on two or more arms of the compound,
then the overall column type becomes BLOB (ANY).

FossilOrigin-Name: 6ebb178c6b688ebd632e91a5ec4c748567833037c679ab3d72fb770deb230fe1

2 years agoUse the new peek/poke() variants throughout tester1.js.
stephan [Wed, 14 Dec 2022 14:40:36 +0000 (14:40 +0000)] 
Use the new peek/poke() variants throughout tester1.js.

FossilOrigin-Name: ef7b783552f7783a728837fcfc81e493b135a7aac59747397e7e3d28f4309f95

2 years agoAdd convenience variants of sqlite3.wasm.peek/poke() for each numeric type to help...
stephan [Wed, 14 Dec 2022 14:28:54 +0000 (14:28 +0000)] 
Add convenience variants of sqlite3.wasm.peek/poke() for each numeric type to help reduce errors related to typos in the final argument (type-name strings). If wasm.xWrap.FuncPtrAdapter is called as a function, instead of a constructor, it now behaves as if it were called as a constructor (previously it threw an exception).

FossilOrigin-Name: 14e3fc01b929fa3f9a2fdbd93deb4a8aad58c111d46369c772def0437152fa75

2 years agoBack out the part of the change in [88a05141c28e5ff1] that adds affinity to
drh [Wed, 14 Dec 2022 09:06:45 +0000 (09:06 +0000)] 
Back out the part of the change in [88a05141c28e5ff1] that adds affinity to
the materialization of a view, as the affinity can be undefined for a compound
query.  This passes all TCL tests, but shows failures in the TH3 tests derived
from [forum:/forumpost/6f842bc5b2dadcb2|forum post 6f842bc5b2dadcb2], presumably
because the WHERE clause of the query uses constraints of the form
"source_crs_code='8675'" instead of "source_crs_code=8675".  Perhaps further
changes on this branch should reimplement affinity on joins in cases where
the affinity is unambiguous.

FossilOrigin-Name: fe5a77bcc4de8f49cc4fe6bd2e2e1f31da8d3bc84120daaa99eb853b06291d15

2 years agoAdd a test to demonstrate/verify which object acts as "this" in a oo1.DB.exec() callback.
stephan [Wed, 14 Dec 2022 08:12:01 +0000 (08:12 +0000)] 
Add a test to demonstrate/verify which object acts as "this" in a oo1.DB.exec() callback.

FossilOrigin-Name: 8fc4b3f10f61e965853a22bf7a64ad2511ef656d66658a7910bac35b0f9805ec

2 years agoA micro-optimization in sqlite3.oo1.DB.exec(). Changed the rowMode option of that...
stephan [Wed, 14 Dec 2022 08:01:34 +0000 (08:01 +0000)] 
A micro-optimization in sqlite3.oo1.DB.exec(). Changed the rowMode option of that method to only accept $X instead of $X, @X, and :X, as the extra options are entirely superfluous and may lead to confusion.

FossilOrigin-Name: 82a6c7fdf59729c182545b15c084b136e34513f340e87a7b6e5aa199117357b0

2 years agoFix a comment in ext/session/test_session.c.
dan [Tue, 13 Dec 2022 19:52:23 +0000 (19:52 +0000)] 
Fix a comment in ext/session/test_session.c.

FossilOrigin-Name: bd814af14b6d67c4f8cf6482a0657f9437811a2820196ea6ccf22514291fe360

2 years agoPrevent the sessions rebaser from generating changesets containing UPDATE records...
dan [Tue, 13 Dec 2022 19:40:56 +0000 (19:40 +0000)] 
Prevent the sessions rebaser from generating changesets containing UPDATE records for which non-PK fields are present in the old.* but not the new.* record. Also update the changeset iterator to work around such changesets.

FossilOrigin-Name: f9cd23dffba06b1982c0a5e5362dba53eba768120a2daa985b4f649d3fea1427

2 years agoRemove an unused variable from sqlite3SubqueryColumnTypes().
drh [Tue, 13 Dec 2022 16:59:09 +0000 (16:59 +0000)] 
Remove an unused variable from sqlite3SubqueryColumnTypes().

FossilOrigin-Name: c6e3ff396947e6954e77195419b35de8b39bd540d3f4bff456bab25b512e1792

2 years agoUse standard datatype names for the column datatypes in views and subqueries.
drh [Tue, 13 Dec 2022 16:55:23 +0000 (16:55 +0000)] 
Use standard datatype names for the column datatypes in views and subqueries.

FossilOrigin-Name: baf2c2413346feb72ecb0bac800be9b945ebb4e01b42212132434d8ddef9cad0

2 years agoRefactor the sqlite3SelectAddColumnTypeAndCollation() routine. Improved
drh [Tue, 13 Dec 2022 15:54:43 +0000 (15:54 +0000)] 
Refactor the sqlite3SelectAddColumnTypeAndCollation() routine.  Improved
comments.  Now called sqlite3SubqueryColumnTypes().

FossilOrigin-Name: 4dfb1b450b87e2c6207c83c102b785781d1dbdeadbeeab6a83f96d58bb96cfbf

2 years agoAdd extra test cases for applying sessions module changesets to databases that have...
dan [Tue, 13 Dec 2022 14:59:28 +0000 (14:59 +0000)] 
Add extra test cases for applying sessions module changesets to databases that have been modified using "ALTER TABLE .. ADD COLUMN".

FossilOrigin-Name: a7b404f21f657f395eddb32e218eae14e09df08fa03f68ca8bba79ea322ce8ba

2 years agoSlightly faster implementation of sqlite3ExprAffinity().
drh [Tue, 13 Dec 2022 13:33:28 +0000 (13:33 +0000)] 
Slightly faster implementation of sqlite3ExprAffinity().

FossilOrigin-Name: 01cf3278c9c00dddcac67aa4b22ca26a52c31932cba35daa634a56b4c264bdeb

2 years agoDocument the role of the sqlite3.client JS API property.
stephan [Tue, 13 Dec 2022 10:54:12 +0000 (10:54 +0000)] 
Document the role of the sqlite3.client JS API property.

FossilOrigin-Name: 5f11f1c7d5f8b627acd2ace277521d39fe2ffb0ef1dfe532e65fb56ea3dfb4d8

2 years agoExtend the sqlite3.wasm function pointer argument converter to be able to handle...
stephan [Tue, 13 Dec 2022 08:25:28 +0000 (08:25 +0000)] 
Extend the sqlite3.wasm function pointer argument converter to be able to handle the "two-layered context" of sqlite3_create_collation() and friends and make use of FuncPtrAdapter to perform JS-to-WASM function conversion for them.

FossilOrigin-Name: 0a60b7215e433f8c50027c70731b11e58d74c90ec5903e66ae42f9c98e40b044

2 years agoMerge recent trunk changes into the coroutine-exp2 branch.
drh [Tue, 13 Dec 2022 00:51:34 +0000 (00:51 +0000)] 
Merge recent trunk changes into the coroutine-exp2 branch.

FossilOrigin-Name: c43f433bcab29db0f1f8afd3948f5a4149e1f277c853c66f99c31f226d82bc0f

2 years agoFurther fix for ticket [57c47526c34f01e8]. If a subquery has a result set
drh [Mon, 12 Dec 2022 21:22:23 +0000 (21:22 +0000)] 
Further fix for ticket [57c47526c34f01e8].  If a subquery has a result set
column of the form "CAST(expr AS NUMERIC)" do not give that column NUMERIC
affinity.  NUMERIC affinity always goes to an integer if able, but a CAST
to numeric is a no-op if the input is a number.  So the two are not equivalent.

FossilOrigin-Name: f0325359d5795237b79f90f21b42d7d942c7e918137cb0231d404365d3041e81

2 years agoIf a subquery has a result column of the form "CAST(... AS NUMERIC)" then cast-to-numeric
drh [Mon, 12 Dec 2022 18:58:53 +0000 (18:58 +0000)] 
If a subquery has a result column of the form "CAST(... AS NUMERIC)" then
give that column no affinity rather than NUMERIC affinity.  This is because
casting to numeric preserves real values that could be integers but numeric
affinity does not.  By using no affinity on the column, we make the behavior
consistent if the subquery is implemented as a co-routine or is materialized.

FossilOrigin-Name: ece07d091c2ef3367a914187e0b6512c1f2390b8c34844536ad50e88c7e8c2f2

2 years agoRevert part of [9386d6f63468] because the new automatic function pointer binding...
stephan [Mon, 12 Dec 2022 18:42:39 +0000 (18:42 +0000)] 
Revert part of [9386d6f63468] because the new automatic function pointer binding cannot properly track per-context function mappings when the context is more complex than a single context-type pointer. e.g. it is fine for sqlite3_trace_v2() but it breaks down with sqlite3_create_collation() because that one needs to use the collation name as part of the context key and we cannot sensibly do so with the current code.

FossilOrigin-Name: 6cd21b79075367227b57bccf829cc7d4ccc7d7fbcfaed226b4c8e942ddae4eb6

2 years agoAdd new logging code SQLITE_NOTICE_RBU and use it when logging for the spurious error...
dan [Mon, 12 Dec 2022 17:33:36 +0000 (17:33 +0000)] 
Add new logging code SQLITE_NOTICE_RBU and use it when logging for the spurious error that RBU injects into SQLite as part of applying an update.

FossilOrigin-Name: cd881d35150be7f28cc1ca1eca0e950b5a039bef61190fcae4f944ef0e91f234

2 years agoMove JS-to-C binding signatures from sqlite3-api-prologue.js to sqlite3-api-glue...
stephan [Mon, 12 Dec 2022 14:31:38 +0000 (14:31 +0000)] 
Move JS-to-C binding signatures from sqlite3-api-prologue.js to sqlite3-api-glue.js to allow for use of the new/experimental sqlite3.wasm.xWrap() feature which automatically binds JS functions to WASM/C as needed, which simplifies creation of bindings which take C function pointers. Reimplement sqlite3_exec(), sqlite3_create_collation(), sqlite3_progress_handler() to use this new feature.

FossilOrigin-Name: 9386d6f634680b4e0fa5487c34c63acb29f0b7a6ae738b8f6164ad084a229b62

2 years agoext/wasm/module-symbols.html: for C APIs which have extended JS-side semantics, link...
stephan [Mon, 12 Dec 2022 11:38:22 +0000 (11:38 +0000)] 
ext/wasm/module-symbols.html: for C APIs which have extended JS-side semantics, link to the JS-side API docs instead of the C docs.

FossilOrigin-Name: d557015208f504c6d5d20ebf1e451b3f07b19590d76371b16a9f4b54e9645282

2 years agoext/wasm/module-symbols.html: add a hyperlink to the API docs for each exported sqlit...
stephan [Mon, 12 Dec 2022 11:22:05 +0000 (11:22 +0000)] 
ext/wasm/module-symbols.html: add a hyperlink to the API docs for each exported sqlite3_...() function.

FossilOrigin-Name: 01d3a9bba3120cfec3f752048281f18ce7ab48fa7584750c097233a9ce095a20

2 years agoRework the internals of how argument/result types are converted to/from wasm in prep...
stephan [Mon, 12 Dec 2022 08:16:47 +0000 (08:16 +0000)] 
Rework the internals of how argument/result types are converted to/from wasm in prep for attempting to support automated conversions of function pointer argument types.

FossilOrigin-Name: 58052d8285cbc2aa8c4f8a9f5c2d33ac12014f6a70afbc93bc4ce5b9fd1f9ee5

2 years agoAdd sqlite3.mjs to the new 'quick' wasm build for the sake of the snapshot build.
stephan [Mon, 12 Dec 2022 07:52:22 +0000 (07:52 +0000)] 
Add sqlite3.mjs to the new 'quick' wasm build for the sake of the snapshot build.

FossilOrigin-Name: 5a3f2224c37c7e28ce627bd98a9907a16635bffeea36e8ead707586aad37ccfe

2 years agoExpose sqlite3_txn_state() to wasm.
stephan [Mon, 12 Dec 2022 07:31:37 +0000 (07:31 +0000)] 
Expose sqlite3_txn_state() to wasm.

FossilOrigin-Name: f6f3397a4667b15a96bdf4189c54789d622fd90351405e963d7f56ac93a9344c

2 years agoExpose a number of infrequently-used sqlite3_...() functions to wasm whose absences...
stephan [Mon, 12 Dec 2022 07:27:22 +0000 (07:27 +0000)] 
Expose a number of infrequently-used sqlite3_...() functions to wasm whose absences were noticed while documenting.

FossilOrigin-Name: 3144e7c0b8633d99daa07d75dabfe6e115ad401110f6f3c85f768e973299f3d9

2 years agoMinor build tweaks in ext/wasm to create a faster-running build for the common dev...
stephan [Sun, 11 Dec 2022 07:53:03 +0000 (07:53 +0000)] 
Minor build tweaks in ext/wasm to create a faster-running build for the common dev-mode cases. No code changes.

FossilOrigin-Name: 6a61b14a6cf8279a5b8b77f934c2b97965f5e3fe4cddb03e78c2c0a840dbe6f6

2 years agoEnsure that the types and collation sequences of a view are taken from the leftmost...
dan [Sat, 10 Dec 2022 19:22:39 +0000 (19:22 +0000)] 
Ensure that the types and collation sequences of a view are taken from the leftmost component of compound SELECTs, even when column names are explicitly provided for the view.

FossilOrigin-Name: 6f0bf892695acaa2f6fd1fccc767340caf5edfdb8b0816bda33d52cc21d5da45

2 years agoEnsure that the types and collation sequences of a view are taken from the leftmost... tkt-679ed6a2
dan [Sat, 10 Dec 2022 17:54:55 +0000 (17:54 +0000)] 
Ensure that the types and collation sequences of a view are taken from the leftmost component of compound SELECTs, even when column names are explicitly provided for the view. Possible fix for [679ed6a2].

FossilOrigin-Name: b0e49aa81a09c183b8baf8346b8a9b593c2b13073958617b6594500958d5bd46

2 years agoRemove -flto from wasm build flags, as it increases build time and doesn't seem to...
stephan [Sat, 10 Dec 2022 17:45:40 +0000 (17:45 +0000)] 
Remove -flto from wasm build flags, as it increases build time and doesn't seem to have a measurable benefit.

FossilOrigin-Name: 35a88747eb0bb9eebb60550f91d0fe0c7a5ae11ec0a1315ae056fd79e9436a3f

2 years agoCorrect wasm heap corruption introduced in test code added in [e144fd5c88fa4] which...
stephan [Sat, 10 Dec 2022 17:20:29 +0000 (17:20 +0000)] 
Correct wasm heap corruption introduced in test code added in [e144fd5c88fa4] which led to unpredictable failures.

FossilOrigin-Name: 6c1e07e3857b38e394853891a9028e88319bad4bc7b7b15078e25f430c3b1222

2 years agoRemove two incorrect calls to structType.dipose() which prematurely freed objects...
stephan [Sat, 10 Dec 2022 15:41:47 +0000 (15:41 +0000)] 
Remove two incorrect calls to structType.dipose() which prematurely freed objects in use by the virtual table test/demo code.

FossilOrigin-Name: 060eb2848975a24ff6683a8a9c4d7546ae36147323b0edae01fb42f52d9bb2d6

2 years agoExpose sqlite3_column_value() to WASM and add sqlite3_column_js().
stephan [Sat, 10 Dec 2022 15:13:29 +0000 (15:13 +0000)] 
Expose sqlite3_column_value() to WASM and add sqlite3_column_js().

FossilOrigin-Name: 7783aa4af1331190fd1f42a71bb724041e2e82b51745f9740926e4ead83a97ed

2 years agoRefactor the internal JS routines for converting UDF results and errors to JS into...
stephan [Sat, 10 Dec 2022 10:24:46 +0000 (10:24 +0000)] 
Refactor the internal JS routines for converting UDF results and errors to JS into public APIs.

FossilOrigin-Name: 35d1d63c7d60119b64341c561294890812837d5432d1d7bed3ed88d6212fbfa0

2 years agoRemove the SQLITE_PREPARE_SAFEOPT flag. The name is obsolete and it is at the
drh [Fri, 9 Dec 2022 18:26:15 +0000 (18:26 +0000)] 
Remove the SQLITE_PREPARE_SAFEOPT flag.  The name is obsolete and it is at the
wrong level.  Instead use the SF_UpdateFrom flags on the Select object.

FossilOrigin-Name: 78723a9a7e72b42d28fc5645661da17f20cedcf864819b861800ad9340007be1

2 years agoDo not allow OOM faults in EQP messages associated with automatic indexes
drh [Fri, 9 Dec 2022 17:33:21 +0000 (17:33 +0000)] 
Do not allow OOM faults in EQP messages associated with automatic indexes
on co-routines to go unreported.

FossilOrigin-Name: d125d5afdf1b0a1c64fc64f180898099af07b8290ea9da49419df75d8b455f71

2 years agoExport sqlite3_result_subtype() and sqlite3_value_dup/free/subtype() to WASM.
stephan [Fri, 9 Dec 2022 15:26:58 +0000 (15:26 +0000)] 
Export sqlite3_result_subtype() and sqlite3_value_dup/free/subtype() to WASM.

FossilOrigin-Name: 4600a7bbdc4cbe14591d48ea19fe5f7de3a0c10a14cdd97fd51e263a13163d10

2 years agoExpose sqlite3_value_frombind/nochange/numeric_type() to WASM. Add a flag to sqlite3_...
stephan [Fri, 9 Dec 2022 15:12:07 +0000 (15:12 +0000)] 
Expose sqlite3_value_frombind/nochange/numeric_type() to WASM. Add a flag to sqlite3_value_to_js() to cause it to return undefined, instead of throwing, if no conversion can be found.

FossilOrigin-Name: de8fc4bf34f80f320012a0e506ed8e3e24806daf67845d5dabb00b916108f6ef

2 years agoRefactor the sqlite3_value-to-JS conversion from an internal detail to sqlite3.capi...
stephan [Fri, 9 Dec 2022 14:46:24 +0000 (14:46 +0000)] 
Refactor the sqlite3_value-to-JS conversion from an internal detail to sqlite3.capi.sqlite3_value_to_js() for use with routines like sqlite3_module::xFilter().

FossilOrigin-Name: f6dbf280f99809a80c99337e4c22a86dea7a35ae41ae9a69144c4502385a0a1f

2 years agoFix typo in the SQLITE_DBCONFIG_LOOKASIDE documentation.
drh [Fri, 9 Dec 2022 13:49:44 +0000 (13:49 +0000)] 
Fix typo in the SQLITE_DBCONFIG_LOOKASIDE documentation.

FossilOrigin-Name: c6e7582aea4ebcc4563afb4367fded1e8a74f6ef522a569460023c340ca24b30

2 years agoRemove some unused sqlite3_status() codes from the JS API. Add custom JS wrappers...
stephan [Fri, 9 Dec 2022 12:12:49 +0000 (12:12 +0000)] 
Remove some unused sqlite3_status() codes from the JS API. Add custom JS wrappers for sqlite3_create_collation/_v2() which accept JS functions (plus tests). Expand the argument options for sqlite3_wasm_db_error() to enable it to translate exception objects to C-level errors.

FossilOrigin-Name: 073a2f1eb006230ae0995a5ea6c789407bcaa819ec15b5064c66d8973ed4671a

2 years agoRename the oft-used, verbose sqlite3.wasm.get/setMemValue() and get/setPtrValue(...
stephan [Fri, 9 Dec 2022 09:23:27 +0000 (09:23 +0000)] 
Rename the oft-used, verbose sqlite3.wasm.get/setMemValue() and get/setPtrValue() to peek/poke() and peek/pokePtr(). The old names are retained as aliases just in case any client code actually uses them, but they are now deprecated.

FossilOrigin-Name: ad0a8139b0b025f8e9d2eca0c303557ef10fdfab8c8b65afb08c510a804073d5

2 years agoMicro-optimization in the oft-activated JS-to-WASM arguments conversion step.
stephan [Fri, 9 Dec 2022 08:44:22 +0000 (08:44 +0000)] 
Micro-optimization in the oft-activated JS-to-WASM arguments conversion step.

FossilOrigin-Name: ee47e9b83ca668b37dc1d8e519048a635693cf33d9967a2d81ff0824b7eea4ba

2 years agoCorrect a test bug which broke the previous checkin's wasm tests in higher optimizati...
stephan [Fri, 9 Dec 2022 07:17:54 +0000 (07:17 +0000)] 
Correct a test bug which broke the previous checkin's wasm tests in higher optimization levels. Test bug - it should not have worked in -O0 mode.

FossilOrigin-Name: f07141b7500c36169c2c96e045acf37ec97a0d75c0a5f4d0ebed4dc1d2094ccf

2 years agoExport sqlite3_status() and sqlite3_stmt_status() to wasm. Expand the arg/return...
stephan [Fri, 9 Dec 2022 05:47:42 +0000 (05:47 +0000)] 
Export sqlite3_status() and sqlite3_stmt_status() to wasm. Expand the arg/return semantics of wasm.get/setPtrValue() and get/setMemValue() to simplify handling of multiple pointers.

FossilOrigin-Name: e144fd5c88fa4151429a2fef3daf389588402e158267f0afa0dfd142527d76b9

2 years agoJS API doc updates.
stephan [Fri, 9 Dec 2022 02:23:15 +0000 (02:23 +0000)] 
JS API doc updates.

FossilOrigin-Name: 4f80fd3b8d4c85894664093d8310d6f5299faac4eb879edc608b3ffcd8558e9a

2 years agoExpose sqlite3_table_column_metadata() to wasm.
stephan [Fri, 9 Dec 2022 02:12:43 +0000 (02:12 +0000)] 
Expose sqlite3_table_column_metadata() to wasm.

FossilOrigin-Name: c31eb509e5cb1025de058132ee9a45d70c84ee47a6abe18811a65ce339f062a0

2 years agoExpose sqlite3_db_status() and sqlite3_db_config() to wasm, noting that the latter...
stephan [Fri, 9 Dec 2022 01:49:17 +0000 (01:49 +0000)] 
Expose sqlite3_db_status() and sqlite3_db_config() to wasm, noting that the latter requires several internal wrappers to account for the various varidic forms (C varargs cannot be bound to wasm).

FossilOrigin-Name: d5753668915c1db204fa80153614653243081ffaddea22f26ad59bb1836948b9

2 years agoReorganization and renaming in the new VFS/vtab JS pieces.
stephan [Fri, 9 Dec 2022 00:50:39 +0000 (00:50 +0000)] 
Reorganization and renaming in the new VFS/vtab JS pieces.

FossilOrigin-Name: 1c2dda177a11fcc5b66e5554507c23ba4b9948a710b3bccfb26963b9851d40a4

2 years agoSupport ".scanstats est" to enable including planner estimates in query profiles.
dan [Thu, 8 Dec 2022 21:05:33 +0000 (21:05 +0000)] 
Support ".scanstats est" to enable including planner estimates in query profiles.

FossilOrigin-Name: 0fe71287c953bd813a34ba383f5debd4d1fc8bf3c74e1e27adacec0d6e207ded

2 years agoFurther docs and minor cleanups in the JS virtual table helper.
stephan [Thu, 8 Dec 2022 18:18:37 +0000 (18:18 +0000)] 
Further docs and minor cleanups in the JS virtual table helper.

FossilOrigin-Name: c31e7488ac1a6b957782b72bd026b1f0590637b631e44a1fdf1dedeb5c587819

2 years agoEase-of-use/legibility improvements in the virtual table JS helpers.
stephan [Thu, 8 Dec 2022 17:07:27 +0000 (17:07 +0000)] 
Ease-of-use/legibility improvements in the virtual table JS helpers.

FossilOrigin-Name: 54c7ad7e08bdb87579398ade366605bfa2e2538a94aabcc6e4cda8e173649760

2 years agoImproved comments on the new co-routine logic. Fix a C++-ism in the code.
drh [Thu, 8 Dec 2022 16:47:16 +0000 (16:47 +0000)] 
Improved comments on the new co-routine logic.  Fix a C++-ism in the code.
Update test cases to accommodate the more aggressive use of co-routines.

FossilOrigin-Name: 9243e850ae656d16adc8f0e5c4dcf3dcf476312cee192c39c38685fc437ccbbd

2 years agoInitial support for virtual tables implemented in JavaScript.
stephan [Thu, 8 Dec 2022 15:00:53 +0000 (15:00 +0000)] 
Initial support for virtual tables implemented in JavaScript.

FossilOrigin-Name: a1454744c770a30a32a6d7b7fc59ef7be48cf67348b238540592850d7c2c7757

2 years agoDo not use a co-routine on a subquery that is participating in a self-join.
drh [Thu, 8 Dec 2022 13:56:06 +0000 (13:56 +0000)] 
Do not use a co-routine on a subquery that is participating in a self-join.

FossilOrigin-Name: ea4306a03cd8dd706100dac3f11653068a25c50c5d06c34ad08534aec0a580bc

2 years agoDescribe the SQLITE_DBCONFIG_RESET_DATABASE flag's policy regarding virtual tables...
stephan [Thu, 8 Dec 2022 12:51:11 +0000 (12:51 +0000)] 
Describe the SQLITE_DBCONFIG_RESET_DATABASE flag's policy regarding virtual tables, per /chat discussion.

FossilOrigin-Name: 53dcb81b029e4422bdc0b5cf694183854b997195427d437b6154ed4dad7ad0ba

2 years agoMore work on the JS vtable tests. wasm-vtab
stephan [Thu, 8 Dec 2022 10:06:07 +0000 (10:06 +0000)] 
More work on the JS vtable tests.

FossilOrigin-Name: 51e3c3b569dce2097063d39dc484f44b2f98cad0a902ef66765ca4cdc3e06f47

2 years agoGot JS non-eponymous vtable working thanks to a hint from Dan.
stephan [Thu, 8 Dec 2022 09:06:20 +0000 (09:06 +0000)] 
Got JS non-eponymous vtable working thanks to a hint from Dan.

FossilOrigin-Name: 750719b4981df62fa2ff3665e6f559ec760609ad2493495628295ad9ae6024fc

2 years agoRemove some dead JS code and tweak some docs.
stephan [Thu, 8 Dec 2022 04:19:38 +0000 (04:19 +0000)] 
Remove some dead JS code and tweak some docs.

FossilOrigin-Name: 0ee495452c014680697aa9035c245024df127a52d1820ab0e02580a015d96ecb