]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
23 months agoMerge fixes from trunk into the jsonb branch.
drh [Thu, 12 Oct 2023 17:47:50 +0000 (17:47 +0000)] 
Merge fixes from trunk into the jsonb branch.

FossilOrigin-Name: a760bd7bcc63aac41c989bb5f4fbc927f9a93fe9c0aa18da2f0131483ec3f189

23 months agoMake sure the journal file is closed when transitioning into MEMORY journal
drh [Thu, 12 Oct 2023 17:41:18 +0000 (17:41 +0000)] 
Make sure the journal file is closed when transitioning into MEMORY journal
mode, to avoid an assertion fault in the new sqlite3_randomness() avoidance
code added by [c84e4483cb44f827].

FossilOrigin-Name: 29937081a986d88f495ad48748c35ff5829f0ac31dd4ad3e48d180ae2fcb9a0c

23 months agoCLI to check for rare prepare failures. [forum:/forumpost/5be6395182|See forum post...
larrybr [Thu, 12 Oct 2023 15:12:38 +0000 (15:12 +0000)] 
CLI to check for rare prepare failures. [forum:/forumpost/5be6395182|See forum post 5be6395182.]

FossilOrigin-Name: 286d1e8012a5f5d9e1fe6dce1a732f725b8a1837f66daf6aefb792e19e96f2d4

23 months agoUnconditionally force use of SQLITE_ENABLE_API_ARMOR in the WASM and JNI builds....
stephan [Wed, 11 Oct 2023 20:37:42 +0000 (20:37 +0000)] 
Unconditionally force use of SQLITE_ENABLE_API_ARMOR in the WASM and JNI builds. Their corresponding test suites still work.

FossilOrigin-Name: c11394b50d0687b6d6abad9c80d5cd3cdce77e9b9c278f40601c460f463744a1

23 months agoFix the use of an uninitialized value that occurs when doing a json_insert()
drh [Wed, 11 Oct 2023 17:24:31 +0000 (17:24 +0000)] 
Fix the use of an uninitialized value that occurs when doing a json_insert()
of a string value that contains embedded U+0000 characters.

FossilOrigin-Name: d3c0cbb90966316be9cd25e3edb501da42731e8a83c13227b90ce17d3975a2c3

23 months agoFix the use of an uninitialized value that occurs when doing a json_insert()
drh [Wed, 11 Oct 2023 17:21:16 +0000 (17:21 +0000)] 
Fix the use of an uninitialized value that occurs when doing a json_insert()
of a string value that contains embedded U+0000 characters.

FossilOrigin-Name: fc5ee9e51ad4556af526a6cefca5ae5a3b1b7affc4edf09832491d6b4f4ba366

23 months agoAdd (prepare, step, reset, finalize) parts of the JNI level-2 stmt wrapper and associ...
stephan [Wed, 11 Oct 2023 13:52:05 +0000 (13:52 +0000)] 
Add (prepare, step, reset, finalize) parts of the JNI level-2 stmt wrapper and associated tests.

FossilOrigin-Name: a7082f186f2b9b6666bbc65f2eadeb74d91fa0a681e3b2468b261ffd322bd249

23 months agoSimplification to sqlite3ApiExit(). Generates identical machine code, but
drh [Wed, 11 Oct 2023 13:34:18 +0000 (13:34 +0000)] 
Simplification to sqlite3ApiExit().  Generates identical machine code, but
easier for humans to read.

FossilOrigin-Name: 793bbfa5af9721bc3a61e8e5eda46dfce2f5ff3f223a7564c9e1b09f11e53cb3

23 months agoFix a missing zero-terminator on a string when processing
drh [Wed, 11 Oct 2023 13:19:37 +0000 (13:19 +0000)] 
Fix a missing zero-terminator on a string when processing
JSON aggregates into JSONB.

FossilOrigin-Name: fb81d570a3d9b8f55e9f278d5240605c5d0f3c5abde51550797999d03cf193a7

23 months agoFix an issue that can arise when processing corrupt JSONB.
drh [Wed, 11 Oct 2023 12:44:17 +0000 (12:44 +0000)] 
Fix an issue that can arise when processing corrupt JSONB.

FossilOrigin-Name: e50045c22296be84c6bea82bb8b310f07bca820c84d4a7349b16da0cf5d2657c

23 months agoImproved robustness against corrupt JSONB.
drh [Wed, 11 Oct 2023 12:21:29 +0000 (12:21 +0000)] 
Improved robustness against corrupt JSONB.

FossilOrigin-Name: 0fbda92bb0eeb40f95c83f717e4e8f5bff1ac82f1c899e9f6d400d67df67214e

23 months agoFix an assertion fault in json_patch() that can occur if the patch JSON
drh [Wed, 11 Oct 2023 11:42:06 +0000 (11:42 +0000)] 
Fix an assertion fault in json_patch() that can occur if the patch JSON
is malformed JSONB.  Report the malformed JSONB instead.

FossilOrigin-Name: a72d54645ca0dd80c60a5ed586049dead3ea7f5fa9ad05c6610a506242a7032a

23 months agoImproved robustness in the decoding of JSON5 text escape sequences found
drh [Tue, 10 Oct 2023 23:02:31 +0000 (23:02 +0000)] 
Improved robustness in the decoding of JSON5 text escape sequences found
in malformed JSONB.

FossilOrigin-Name: 35e0108af2bdd830375c31c525f8ed0e8df64959d89649a88402dc1a5c376612

23 months agoFix an off-by-one error in the changes from the previous check-in on
drh [Tue, 10 Oct 2023 18:55:29 +0000 (18:55 +0000)] 
Fix an off-by-one error in the changes from the previous check-in on
the jsonb branch.

FossilOrigin-Name: 216191b113da43516d31301fb133173add66358d503677ab997bc82cc88bfea4

23 months agoImproved robustness when translating corrupt JSONB into JSON text.
drh [Tue, 10 Oct 2023 18:42:08 +0000 (18:42 +0000)] 
Improved robustness when translating corrupt JSONB into JSON text.

FossilOrigin-Name: 0caa320d9099adbaf98e3719003dbdc4d158abcb3d8a1af20fbcd4c08c970f4a

23 months agoFix a potential buffer overrun due to corrupt JSONB.
drh [Tue, 10 Oct 2023 18:32:14 +0000 (18:32 +0000)] 
Fix a potential buffer overrun due to corrupt JSONB.

FossilOrigin-Name: 5cbb861fc6cb7421a81c957ba9d576e0ae92cb4ed725cdb539b364d66f4ee145

23 months agoFix bugs uncovered by the fuzzer.
drh [Tue, 10 Oct 2023 18:04:40 +0000 (18:04 +0000)] 
Fix bugs uncovered by the fuzzer.

FossilOrigin-Name: c96eb7fb618dc0a5aeec8a5e85076475b77dcd56309438aba1f9bddfc8921e3c

23 months agoMerge the latest trunk enhancements into the jsonb branch.
drh [Tue, 10 Oct 2023 17:34:41 +0000 (17:34 +0000)] 
Merge the latest trunk enhancements into the jsonb branch.

FossilOrigin-Name: f93f16c94d0a58dfa90939e84aba048be958c7b085b45a6f25c2243fdf79b3aa

23 months agoFix a bug in the mkautoconfamal.sh script, introduced by check-in [3308fdda4b81c110]
drh [Tue, 10 Oct 2023 15:33:05 +0000 (15:33 +0000)] 
Fix a bug in the mkautoconfamal.sh script, introduced by check-in [3308fdda4b81c110]
so that the "snapshot-tarball" and "amalgamation-tarball" makefile targets
work again when run from outside of the source tree.

FossilOrigin-Name: 65ccf5fef812d43aed9e00af36c90e1a499d197e30148753790445e25ee1324c

23 months agoStart adding tests for the second JNI layer.
stephan [Tue, 10 Oct 2023 12:16:04 +0000 (12:16 +0000)] 
Start adding tests for the second JNI layer.

FossilOrigin-Name: 0177f4dfe8a5c03c1d5dd279c6babe5a87b596c2351373f845b89fc6abf7947b

23 months agoUse snprintf() in place of sprintf() in a debugging function in the CLI.
drh [Mon, 9 Oct 2023 22:45:10 +0000 (22:45 +0000)] 
Use snprintf() in place of sprintf() in a debugging function in the CLI.

FossilOrigin-Name: 5e5e4d2b4958c329578d1e5af4ed25c1b774f0ed2d15fa6747d7d7fbbba4fa46

2 years agoSystematize the names of some of the translation function in the JSON
drh [Mon, 9 Oct 2023 18:33:01 +0000 (18:33 +0000)] 
Systematize the names of some of the translation function in the JSON
implementation.

FossilOrigin-Name: db44bd1d62084ef69c808f7d07e0a25d5a089dcb8b98b1b5d026777591bbdefc

2 years agoAvoid calling sqlite3_randomness and taking the PRNG mutex when writing a journal...
dan [Mon, 9 Oct 2023 17:54:34 +0000 (17:54 +0000)] 
Avoid calling sqlite3_randomness and taking the PRNG mutex when writing a journal header in "journal_mode=memory" mode.

FossilOrigin-Name: c84e4483cb44f827416d8caafa22f076b2f31b2024fe8c5b5bcb0c9955149d11

2 years agoAdd a TCL script that does various verification checks on the source tree
drh [Mon, 9 Oct 2023 14:56:15 +0000 (14:56 +0000)] 
Add a TCL script that does various verification checks on the source tree
to make sure that generated code has been updated correctly.

FossilOrigin-Name: 1f1a358af77f4386f98010eeae8487e6d39548a6dfe58c2664552490e7661122

2 years agoFix a compiler warning caused by the previous check-in.
drh [Mon, 9 Oct 2023 14:47:25 +0000 (14:47 +0000)] 
Fix a compiler warning caused by the previous check-in.

FossilOrigin-Name: 7e8768bf8b4002b1c287f2bc95262548e2ae81b437936154f2bb1ea1f739a904

2 years agoTurn on SEH by default when building using MSVC.
drh [Mon, 9 Oct 2023 14:05:21 +0000 (14:05 +0000)] 
Turn on SEH by default when building using MSVC.

FossilOrigin-Name: f57e8275cf1ab3ad8027044cda0893282d1c403a5aa9fabbb1c7de280597b5cd

2 years agoMerge the latest trunk fixes and enhancements into the jsonb branch, and
drh [Mon, 9 Oct 2023 12:57:03 +0000 (12:57 +0000)] 
Merge the latest trunk fixes and enhancements into the jsonb branch, and
especially the JSON cache spill UAF fix.

FossilOrigin-Name: 9422c24f4a8b290dcae61e50ec81be5b314b22c61a2bca1e194e47da1316b6e6

2 years agoFix a potential UAF caused by JSON parser cache spill.
drh [Mon, 9 Oct 2023 12:46:53 +0000 (12:46 +0000)] 
Fix a potential UAF caused by JSON parser cache spill.
[forum:/forumpost/b25edc1d46|Forum post b25edc1d46].

FossilOrigin-Name: a163fecca90cab9d1b7bf8ebac78d498775eed7b6d81e7920e3401633c3a4b60

2 years agoFlesh out the error state captured by SqliteException.java. Doc additions.
stephan [Mon, 9 Oct 2023 12:45:28 +0000 (12:45 +0000)] 
Flesh out the error state captured by SqliteException.java. Doc additions.

FossilOrigin-Name: 5c5397ff15543f4b3620244d9e57e15708eafcab1d42c9f87b4a60f0c01e8858

2 years agoFix harmless compiler warning in the test module for sessions.
drh [Mon, 9 Oct 2023 12:39:59 +0000 (12:39 +0000)] 
Fix harmless compiler warning in the test module for sessions.

FossilOrigin-Name: 3d5ec99397c183cfb8c5d31e1967e0df8a4d6edbea92bbdf728571e3a6a36d68

2 years agoAdd JNI Sqlite and SqliteException classes. Add Tester2.java as the main test app...
stephan [Mon, 9 Oct 2023 11:46:32 +0000 (11:46 +0000)] 
Add JNI Sqlite and SqliteException classes. Add Tester2.java as the main test app for the high-level API.

FossilOrigin-Name: 6acf52be7abce8dcf434c5ebf0d5e88859b033e6418077846247ecf00ccf9381

2 years agoMinor JNI doc and public/private cleanups.
stephan [Mon, 9 Oct 2023 10:44:10 +0000 (10:44 +0000)] 
Minor JNI doc and public/private cleanups.

FossilOrigin-Name: c49d36ece283274963ce2e5a4db1e8f586dffa22e47f4adb93c625f918c3fd5d

2 years agoRename SQLite3Jni to CApi to (A) reduce name prefix collisions with incoming classes...
stephan [Mon, 9 Oct 2023 10:30:54 +0000 (10:30 +0000)] 
Rename SQLite3Jni to CApi to (A) reduce name prefix collisions with incoming classes and (B) align with its counterpart in the JS build. Remove the Canonical annotation because (A) the new code separation will inherently make that distinction and (B) the line between truly canonical and semi-canonical (e.g. differing in signature overloads) is blurry enough that consistent use of that annocation is becoming an unnecessary burden.

FossilOrigin-Name: ca216b4486aff7d206ebfc3a5e84d48919c282425d4313396bc19313ffca8a0e

2 years agoRemove some unnecessary code. Report errors for invalid JSONB input on
drh [Sat, 7 Oct 2023 23:35:07 +0000 (23:35 +0000)] 
Remove some unnecessary code.  Report errors for invalid JSONB input on
an extract.

FossilOrigin-Name: cbea16c29eb0507f39b5a1cf744a3bb9bb7c71ac156e84a19d03a37cb1816891

2 years agoThe return from sqlite3_value_blob() in jsonFuncArgMightBeBinary() might
drh [Sat, 7 Oct 2023 19:46:22 +0000 (19:46 +0000)] 
The return from sqlite3_value_blob() in jsonFuncArgMightBeBinary() might
be a NULL pointer.  Check for that case.

FossilOrigin-Name: 7b52b266b066f1385144c1103a3a411306db5f44568366ae1e93cd8cce799bbc

2 years agoImproved detection of malformed JSONB when parsing it into a JsonNode array.
drh [Sat, 7 Oct 2023 19:40:20 +0000 (19:40 +0000)] 
Improved detection of malformed JSONB when parsing it into a JsonNode array.

FossilOrigin-Name: ed99a788415e1f8375bd5ec004dd18b1cd0fae4aa94558170882ca487f6dff93

2 years agoFix the jsonbChangePayloadSize() routine so that it shifts the payload in order
drh [Sat, 7 Oct 2023 19:05:10 +0000 (19:05 +0000)] 
Fix the jsonbChangePayloadSize() routine so that it shifts the payload in order
to always render the most compact encoding of the payload size.  This is
necessary as sometimes (as discovered by dbsqlfuzz) the payload size can
grow significantly due to json_insert() or json_replace().

FossilOrigin-Name: 8d6d04ca975ec55c419d40d8463c433b0db698c9fb4812ab9f16d4ee5bee460e

2 years agoImprovements to error messages returned when the ->> operator fails.
drh [Sat, 7 Oct 2023 17:50:06 +0000 (17:50 +0000)] 
Improvements to error messages returned when the ->> operator fails.

FossilOrigin-Name: 2f3388f14c843f1c02926e8b929365c06c1f1f4ea6fe6316092c3799c14549d3

2 years agoFix a problem with sqlite3changegroup_schema() and patchsets.
dan [Sat, 7 Oct 2023 17:29:10 +0000 (17:29 +0000)] 
Fix a problem with sqlite3changegroup_schema() and patchsets.

FossilOrigin-Name: c4ab4200dc2538e1132d87d70fd309b26b0da8a918fede1cb09b567ea40ec889

2 years agoAdd the sqlite3changegroup_schema() API. To allow changegroup objects to upgrade...
dan [Sat, 7 Oct 2023 16:32:02 +0000 (16:32 +0000)] 
Add the sqlite3changegroup_schema() API. To allow changegroup objects to upgrade the schema of a changeset/patchset under some circumstances.

FossilOrigin-Name: 03f9e50b15c9c2fb4636dee24c1491c45322578b9fed08c6f4360be07c5c3830

2 years agoFix a problem with the changes on this branch and tables that use an implicit primary... session-alter
dan [Sat, 7 Oct 2023 16:07:02 +0000 (16:07 +0000)] 
Fix a problem with the changes on this branch and tables that use an implicit primary key.

FossilOrigin-Name: 1f9d10235ff32e72074be695049567135b02e681068ce117b66adc14a6214449

2 years agoMerge the memory leak fix from trunk.
drh [Sat, 7 Oct 2023 11:37:00 +0000 (11:37 +0000)] 
Merge the memory leak fix from trunk.

FossilOrigin-Name: 358de1b09f3d5ec0fe459775b0a2a99dfa235817327016b472aaa1ed56d952e6

2 years agoImproved error messages from search on JSONB.
drh [Sat, 7 Oct 2023 11:36:16 +0000 (11:36 +0000)] 
Improved error messages from search on JSONB.

FossilOrigin-Name: 96cfdc31e305406123f6ef1b920423f71902dc4b34381c3efb720274343d37cc

2 years agoReport unknown JSONB element type when parsing JSONB into JsonNode.
drh [Sat, 7 Oct 2023 09:13:59 +0000 (09:13 +0000)] 
Report unknown JSONB element type when parsing JSONB into JsonNode.

FossilOrigin-Name: 1f4d3268257bda234c66c3767451b3d39d7b4c7c73a779ad396d9dfc5315905c

2 years agoAdd a test case to prevent a regression of the leak fixed in the previous
drh [Sat, 7 Oct 2023 08:15:47 +0000 (08:15 +0000)] 
Add a test case to prevent a regression of the leak fixed in the previous
trunk check-in.

FossilOrigin-Name: f99ff655d09763c4a22d065041644ece793d84c82c644931e89ccf50c4f4564a

2 years agoFix a resource leak: sqlite3_blob_reopen() was failing to invoke the
drh [Sat, 7 Oct 2023 08:00:54 +0000 (08:00 +0000)] 
Fix a resource leak: sqlite3_blob_reopen() was failing to invoke the
xDel() distructor on a register when it sets that register to the new
rowid.  This was never a problem prior to the large-column cache of
[771fe35074b50b8d] as that destructor was always a no-op.
dbsqlfuzz cd96368deaece480fb94d42427dde053737a650e.

FossilOrigin-Name: 545edd5ecf20a7feb99dc5ce6f338fa1f172c2e17b240cbede497f0729dbd3d7

2 years agoCorrect handling of "raw" strings in JSON. This requires three test-case
drh [Fri, 6 Oct 2023 23:02:06 +0000 (23:02 +0000)] 
Correct handling of "raw" strings in JSON.  This requires three test-case
changes in TH3 to add double-quotes to the path outputs from json_tree().
The new behavior is correct, I believe.

FossilOrigin-Name: ab2bf3e3596dfa7566f4a130adeccbef4056c7321181112a875477193583f30c

2 years agoImproved error detection for JSONB inputs.
drh [Fri, 6 Oct 2023 22:16:09 +0000 (22:16 +0000)] 
Improved error detection for JSONB inputs.

FossilOrigin-Name: 6945e11aa441ace52b93cdbb81ac45b6f809987f3dbc522251e63f8cb948fddd

2 years agoAdd missing source code comments and fix other issues with the new code on this branch.
dan [Fri, 6 Oct 2023 20:39:42 +0000 (20:39 +0000)] 
Add missing source code comments and fix other issues with the new code on this branch.

FossilOrigin-Name: df39fbe9ab87937beb77af353cd55602290b185e222e0a92a3ebf9a9a0b9e2e7

2 years agoUpdate this branch with latest changes from the trunk.
dan [Fri, 6 Oct 2023 19:46:19 +0000 (19:46 +0000)] 
Update this branch with latest changes from the trunk.

FossilOrigin-Name: 897e926a5eaa0eab7e09e5003e4c15c974897be298a18ae85345962dc3f410a1

2 years agoAdd tests for the sqlite3changegroup_schema() API.
dan [Fri, 6 Oct 2023 19:01:43 +0000 (19:01 +0000)] 
Add tests for the sqlite3changegroup_schema() API.

FossilOrigin-Name: 5dab481c101b1523b1cfde92678cbc654ea26d946bf29da372d71c1f89cbaf46

2 years agoIncremental improvements to the JSONB logic.
drh [Fri, 6 Oct 2023 18:21:47 +0000 (18:21 +0000)] 
Incremental improvements to the JSONB logic.

FossilOrigin-Name: fe326829c27715e249f727ba797c7df6491e874ec205a0a82ee09c78d61c6e1f

2 years agoFixes to rendering JSON5 extensions encoded as JSONB.
drh [Fri, 6 Oct 2023 15:35:42 +0000 (15:35 +0000)] 
Fixes to rendering JSON5 extensions encoded as JSONB.

FossilOrigin-Name: 5a17e4479aad2d8313170e5de83a1c52f30b55d9d4fb776024fa6622e175c63b

2 years agoFix compiler warnings.
drh [Fri, 6 Oct 2023 14:59:40 +0000 (14:59 +0000)] 
Fix compiler warnings.

FossilOrigin-Name: 5227add3c8d509de2e081249163fafdf30ac3173a6d710957f3c3b6f03e7017e

2 years agoImprovements to error handling.
drh [Fri, 6 Oct 2023 14:52:49 +0000 (14:52 +0000)] 
Improvements to error handling.

FossilOrigin-Name: b41dd237fb6c0dd7daedeaaf81dbc4fdb31cf511fd32cd3d4ee69db34e389915

2 years agoMerge compiler warning fixes from trunk into the jsonb branch.
drh [Fri, 6 Oct 2023 13:05:42 +0000 (13:05 +0000)] 
Merge compiler warning fixes from trunk into the jsonb branch.

FossilOrigin-Name: 6409d307915f8969f12df2d5ffa961645bd4db7ccfbd6f52237a217b6a867252

2 years agoRemove an unused parameter from the recomputeColumnsNotIndexed() routine in
drh [Fri, 6 Oct 2023 12:55:53 +0000 (12:55 +0000)] 
Remove an unused parameter from the recomputeColumnsNotIndexed() routine in
order to squash a harmless compiler warning.

FossilOrigin-Name: 9bf4bfd68080367b58594e0d44b110b3ee9766420f648537fd7bc638dacefb72

2 years agoEnsure that all fields of static sqlite3_module objects are explicitly
drh [Fri, 6 Oct 2023 12:51:05 +0000 (12:51 +0000)] 
Ensure that all fields of static sqlite3_module objects are explicitly
initialized, in order to hush-up nuisance compiler warnings.

FossilOrigin-Name: f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7

2 years agoRemove and unused static variable from shell.c.in in order to silence a
drh [Fri, 6 Oct 2023 12:22:14 +0000 (12:22 +0000)] 
Remove and unused static variable from shell.c.in in order to silence a
harmless compiler warning.

FossilOrigin-Name: 477577120b897bf15edc2a85e220d5c64a1d5a245354939269f6753d8140ac95

2 years agoIncrease the size of some variables associated with the PMA sorter in order
drh [Fri, 6 Oct 2023 12:15:01 +0000 (12:15 +0000)] 
Increase the size of some variables associated with the PMA sorter in order
to avoid any possibility of a signed integer overflow.
[https://bugs.chromium.org/p/chromium/issues/detail?id=1489025|Chromium fuzzer issue 1489025].

FossilOrigin-Name: dc3be3af471d90dd810c1e2cc59e83cf6a57f01971b1258ea0da402e4d577ef2

2 years agoImprovements to coping with malformed JSONB.
drh [Fri, 6 Oct 2023 00:06:26 +0000 (00:06 +0000)] 
Improvements to coping with malformed JSONB.

FossilOrigin-Name: 563cde404cec4c6559ae0c5fc5edbc878fee874b36562ce2fac5049cc8349343

2 years agoBetter error detection when doing a lookup on a JSONB.
drh [Thu, 5 Oct 2023 23:05:35 +0000 (23:05 +0000)] 
Better error detection when doing a lookup on a JSONB.

FossilOrigin-Name: 6e8e0eedbf06e175af6ef230f1ce9a5ad84698b1c6dcd2794d878c746e7b6be4

2 years agoImprovements to comments. No changes to code.
drh [Thu, 5 Oct 2023 22:52:43 +0000 (22:52 +0000)] 
Improvements to comments.  No changes to code.

FossilOrigin-Name: ac74d7877685006e43684edd6a2d22be8c9857f9f9eb52fc5b3c182d5e2fdb8d

2 years agoTurn an unreachable branch into an assert().
drh [Thu, 5 Oct 2023 20:17:01 +0000 (20:17 +0000)] 
Turn an unreachable branch into an assert().

FossilOrigin-Name: 0f75199160e48fa8c44f986f1af777adf19e40fbd114a6f58e24d5e6dede779d

2 years agoAdd the sqlite3changegroup_schema() API. To allow changegroups to handle differences...
dan [Thu, 5 Oct 2023 19:09:23 +0000 (19:09 +0000)] 
Add the sqlite3changegroup_schema() API. To allow changegroups to handle differences in schema created by ALTER TABLE ADD COLUMN.

FossilOrigin-Name: 309deee2dd8dd07623fce79f6bb62d5279d140dd0be3b34bc42af20b0507726b

2 years agoFix the parsing of non-standard "Infinity" and "NaN" values from text into
drh [Thu, 5 Oct 2023 18:33:19 +0000 (18:33 +0000)] 
Fix the parsing of non-standard "Infinity" and "NaN" values from text into
JSONB.

FossilOrigin-Name: df1fbbeb83a2b4a496c9de0d86c7c8c677f8fe3bc770da163dcc1d338a17b58b

2 years agoChange the json_valid(X) routine to return true whenever X is a blob that
drh [Thu, 5 Oct 2023 18:09:12 +0000 (18:09 +0000)] 
Change the json_valid(X) routine to return true whenever X is a blob that
could plausibly be a valid JSONB.

FossilOrigin-Name: 425f0b85a6f8ad0604c4a5faa18efb90436fedb1fe2612a559147c62cff8b7e7

2 years agoFix the text-to-JSONB parser so that it handles some JSON5 floating point
drh [Thu, 5 Oct 2023 17:52:39 +0000 (17:52 +0000)] 
Fix the text-to-JSONB parser so that it handles some JSON5 floating point
literals correctly.

FossilOrigin-Name: 564edb3b6dd752e09e445e3a25c2f5394ceede2a2cdff251d6433dadc0b3644f

2 years agoSlightly stricter testing for when a BLOB is valid JSONB: If the element
drh [Thu, 5 Oct 2023 16:33:00 +0000 (16:33 +0000)] 
Slightly stricter testing for when a BLOB is valid JSONB:  If the element
is a null, true, or false, its payload size must be zero.

FossilOrigin-Name: 487781be8a93d9b8d870efb9f25822bb4bbcf9d39d571d1017e9c29043ea515d

2 years agoFix a memory leak following a syntax error in jsonb().
drh [Thu, 5 Oct 2023 15:05:33 +0000 (15:05 +0000)] 
Fix a memory leak following a syntax error in jsonb().

FossilOrigin-Name: bf4b36eda8e200b67041ebdf60fc31d0325bd84185272f8d390c56a91d6ac1ee

2 years agoAllow the PG-style syntax for the PATH operand on the right-hand side of
drh [Thu, 5 Oct 2023 15:02:00 +0000 (15:02 +0000)] 
Allow the PG-style syntax for the PATH operand on the right-hand side of
the ->> and -> operators.

FossilOrigin-Name: bae5071b0834aa3b7fd4bd871f863e1b148c6558989c8f6cdd02dc4da4770953

2 years agoMerge trunk enhancements into the jsonb branch.
drh [Thu, 5 Oct 2023 11:22:16 +0000 (11:22 +0000)] 
Merge trunk enhancements into the jsonb branch.

FossilOrigin-Name: be5907b648386e05530d1e321e2a3e563e07e99f08373aaf9a3452adc9228dc3

2 years agoImproved detection of corrupt databases in balance_nonroot().
drh [Thu, 5 Oct 2023 11:06:10 +0000 (11:06 +0000)] 
Improved detection of corrupt databases in balance_nonroot().
dbsqlfuzz d1cf013c50a620b68c2a5bd240d29afd65e5f58e.

FossilOrigin-Name: a2464bbb825b5976ef974a2e6c17ea150f5e6fcd0dd0f144b9f9c1c22a9c9c82

2 years agoDo not squelch exceptions from SAHPool VFS importDb() - rethrow them. Problem reporte...
stephan [Thu, 5 Oct 2023 11:04:49 +0000 (11:04 +0000)] 
Do not squelch exceptions from SAHPool VFS importDb() - rethrow them. Problem reported in [forum:c80fc578809b80a3|forum post c80fc578809b80a3].

FossilOrigin-Name: 325bcdea4a436e514d83095d3893caf07a714b718e1b643507179b101c108e3b

2 years agoRemove a stray blank line from the beginning of btree.c. No functional
drh [Thu, 5 Oct 2023 10:35:51 +0000 (10:35 +0000)] 
Remove a stray blank line from the beginning of btree.c.  No functional
code changes.

FossilOrigin-Name: c89983dcfc208faa86b31717144c069572598e9770228264d69a044a84bde277

2 years agoAllow a session object to generate a changeset, even if columns were added to one...
dan [Wed, 4 Oct 2023 21:15:24 +0000 (21:15 +0000)] 
Allow a session object to generate a changeset, even if columns were added to one of the tables using ALTER TABLE ADD COLUMN while the changeset was being collected.

FossilOrigin-Name: a3f435eccf3a2aa11cb7420e94af5efcdfa04e9c169c5aaf61fa5cdcb165ceef

2 years agoThe Makefile distinguishes between tcl8.4 and tcl8.5. Some makefile targets
drh [Wed, 4 Oct 2023 12:49:08 +0000 (12:49 +0000)] 
The Makefile distinguishes between tcl8.4 and tcl8.5.  Some makefile targets
require tcl8.5, but others (ex: "sqlite3.c", "shell.c", and "sqlite3") require
only tcl8.4.

FossilOrigin-Name: 770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e

2 years agoModify the main makefile so that it fails with an error if the tclsh found
drh [Wed, 4 Oct 2023 11:52:44 +0000 (11:52 +0000)] 
Modify the main makefile so that it fails with an error if the tclsh found
by ./configure is not tclsh 8.5 or later.
[forum:/forumpost/4380363682708ece|Forum post 4380363682708ece].

FossilOrigin-Name: 1765f3b5a00a8ca20a7b9e18ac7f9d7de0679470b234b83aea83aa5b4d4d34e6

2 years agoFix a memory leak in JSON group-aggregates when the output is JSONB.
drh [Tue, 3 Oct 2023 22:40:22 +0000 (22:40 +0000)] 
Fix a memory leak in JSON group-aggregates when the output is JSONB.

FossilOrigin-Name: 08e7db138b636890cb29a76d65c2069c6e2ff44470fa4bca14f4526fe5f195ae

2 years agoFix a bug in the jsonReturnFromBlob() function that causes a positive result
drh [Tue, 3 Oct 2023 21:54:09 +0000 (21:54 +0000)] 
Fix a bug in the jsonReturnFromBlob() function that causes a positive result
for a negative value for when a JSON integer is too large and needs to be
converted into double.

FossilOrigin-Name: dca684da0c29ec78460362f972ea7747be42c13c4d1325da9d62c1ea58022e39

2 years agoFix problems in the "json" output column of the json_tree() virtual table
drh [Tue, 3 Oct 2023 20:58:39 +0000 (20:58 +0000)] 
Fix problems in the "json" output column of the json_tree() virtual table
for the case when the input is JSONB.

FossilOrigin-Name: fefa4475c496aab32fe7b9cc203747ce4faf7448da4f29b807e5486c7686238d

2 years agoImproved handling of OOM while translating the JsonNode representing into
drh [Tue, 3 Oct 2023 19:37:19 +0000 (19:37 +0000)] 
Improved handling of OOM while translating the JsonNode representing into
the BLOB representation.

FossilOrigin-Name: ef5956710bb542d6045c82937d02218a7ed45af94cf3959b0c180268e04d14e1

2 years agoMerge the latest trunk enhancements into the jsonb branch.
drh [Tue, 3 Oct 2023 11:36:47 +0000 (11:36 +0000)] 
Merge the latest trunk enhancements into the jsonb branch.

FossilOrigin-Name: e6406a9865b75dea2f26d3ee4f4c206958400059c7f92ced88edc8507dd3c82f

2 years agoFix a problem in the JSONB parser that comes up following an OOM.
drh [Tue, 3 Oct 2023 10:59:01 +0000 (10:59 +0000)] 
Fix a problem in the JSONB parser that comes up following an OOM.

FossilOrigin-Name: 355acfb18897254f6b6444a21d781b5e10e930b81952850dd2a40d88bbf2f3db

2 years agoFix an issue with the use of jsonb_group_array() and jsonb_group_object()
drh [Tue, 3 Oct 2023 10:43:30 +0000 (10:43 +0000)] 
Fix an issue with the use of jsonb_group_array() and jsonb_group_object()
when used by window functions.

FossilOrigin-Name: 808bd349ba587fbcdc4aea3f9c08e0df01ba08dec181c5af5ea157e89d86ff7b

2 years agoNew test cases for JSONB.
drh [Mon, 2 Oct 2023 23:56:46 +0000 (23:56 +0000)] 
New test cases for JSONB.

FossilOrigin-Name: 6d4aeff5751722c83ebb0e1f21072b72be418c64dcf28ee032d3a548e1b3a951

2 years agoFix jsonb_insert() so that it does not behave like jsonb_set().
drh [Mon, 2 Oct 2023 20:16:06 +0000 (20:16 +0000)] 
Fix jsonb_insert() so that it does not behave like jsonb_set().
New test cases added.

FossilOrigin-Name: 54197149b811d30b6c4487eedf5692b164ed0f90cfcc541aa3157094f5f17f6a

2 years agoJNI: when fetching text-or-blob/length pairs, fetch the text-or-blob first, then...
stephan [Mon, 2 Oct 2023 17:12:16 +0000 (17:12 +0000)] 
JNI: when fetching text-or-blob/length pairs, fetch the text-or-blob first, then the length, as the API docs suggest.

FossilOrigin-Name: e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1

2 years agoFix the length of the string in the new concat() and concat_ws() functions.
drh [Mon, 2 Oct 2023 17:06:28 +0000 (17:06 +0000)] 
Fix the length of the string in the new concat() and concat_ws() functions.

FossilOrigin-Name: 325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f

2 years agoRemove an ALWAYS() from a branch that can in fact be false following an OOM
drh [Mon, 2 Oct 2023 15:56:37 +0000 (15:56 +0000)] 
Remove an ALWAYS() from a branch that can in fact be false following an OOM
fault.

FossilOrigin-Name: 3a1feb1c469d3dd50e2558581199b16bfd59b9d5bcb0de5f1a8f0ec30a17b4d1

2 years agoNew test cases for JSONB.
drh [Mon, 2 Oct 2023 14:51:28 +0000 (14:51 +0000)] 
New test cases for JSONB.

FossilOrigin-Name: d624c31e5c49e1ce63b4b72caa42a61c5167866f47d842fbcfe4e826fd079d7c

2 years agoPointer-casting-related fixes for JNI on 32-bit ARM (pi4 armv7l).
stephan [Mon, 2 Oct 2023 14:44:28 +0000 (14:44 +0000)] 
Pointer-casting-related fixes for JNI on 32-bit ARM (pi4 armv7l).

FossilOrigin-Name: 54441039ae3ebe39e42f008f77ce1be117cbda6daeed8b01739ad42a3c1f0754

2 years agoAllow json_replace() to accept JSONB arguments as the new value.
drh [Mon, 2 Oct 2023 13:35:06 +0000 (13:35 +0000)] 
Allow json_replace() to accept JSONB arguments as the new value.

FossilOrigin-Name: 95eb7b37fab29931924311f541d52173ef77a448efc8771b1a1783ccd786d23d

2 years agoImprovements to error handling for BLOB inputs on JSON.
drh [Mon, 2 Oct 2023 13:20:43 +0000 (13:20 +0000)] 
Improvements to error handling for BLOB inputs on JSON.

FossilOrigin-Name: 14f20ecbfab44934e86f1ac7a3f745b989aa8190c6df119ff5aa8100fa248d93

2 years agoGather forward references into a single place for the JSON code. Allow
drh [Mon, 2 Oct 2023 12:40:04 +0000 (12:40 +0000)] 
Gather forward references into a single place for the JSON code.  Allow
JSONB arguments to json_array() and json_object() and similar.

FossilOrigin-Name: c352201b8c299c330d9abbff6dbcbcbcf00ada53183d3cd91020ec772e066357

2 years agoFix problems following OOM in JSONB parsing.
drh [Sun, 1 Oct 2023 18:59:34 +0000 (18:59 +0000)] 
Fix problems following OOM in JSONB parsing.

FossilOrigin-Name: 0d8cd6b5fb592f88f593ceaad9cdfa95dcfdf14169c3a56a5becbd66d62fd02b

2 years agoAdd JNI binding for sqlite3_normalized_sql().
stephan [Sun, 1 Oct 2023 12:15:38 +0000 (12:15 +0000)] 
Add JNI binding for sqlite3_normalized_sql().

FossilOrigin-Name: 2532e5662a2bbb3e6b4c4be3fad035734b684bdf59b178cb64b444ca6d8b956b

2 years agoMake JNI binding of sqlite3_value_frombind() return boolean instead of int and add...
stephan [Sun, 1 Oct 2023 11:53:40 +0000 (11:53 +0000)] 
Make JNI binding of sqlite3_value_frombind() return boolean instead of int and add tests for it.

FossilOrigin-Name: 906e2ed3e9647f5c2355e9fea2beee141767cae7016da9fa1fe88283726b9369

2 years agoFix JNI binding to compile without SQLITE_ENABLE_PREUPDATE_HOOK. Add build option...
stephan [Sat, 30 Sep 2023 17:08:29 +0000 (17:08 +0000)] 
Fix JNI binding to compile without SQLITE_ENABLE_PREUPDATE_HOOK. Add build option to disable all optional ENABLE flags.

FossilOrigin-Name: c04022b7407f77eaf0175e831ebcd6bbdc0af1cef0d42c5c11102aa8484f24ca

2 years agoRestore the trunk version of sqlite3_user_data(). Fix the xColumn for virtual
drh [Sat, 30 Sep 2023 16:50:17 +0000 (16:50 +0000)] 
Restore the trunk version of sqlite3_user_data().  Fix the xColumn for virtual
tables so that the sqlite3_context contains a valid but NULL user data pointer.

FossilOrigin-Name: 15ffd932fecc82a5791b2024f55d2ec80887e8eb7345de68d6f5cac4912cfbe8