]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoMore API_ARMOR additions.
stephan [Sat, 14 Oct 2023 14:53:18 +0000 (14:53 +0000)] 
More API_ARMOR additions.

FossilOrigin-Name: 78ebf838f645742f87733665cd72af736df345683b27377a2c8310c893b1769d

2 years 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

2 years 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

2 years 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

2 years 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

2 years agoAdd missing JNI bindings for sqlite3_db_readonly() and sqlite3_db_name(). Code-adjace...
stephan [Sat, 14 Oct 2023 12:19:59 +0000 (12:19 +0000)] 
Add missing JNI bindings for sqlite3_db_readonly() and sqlite3_db_name(). Code-adjacent tweaks for the API_ARMOR audit.

FossilOrigin-Name: e5eace747ae656f1e05a346e53a2827242e57107567d2c3470e292cf0b40858d

2 years agoBug fix in sqlite3_analyzer: for databases larger than 1GiB, take into
drh [Sat, 14 Oct 2023 10:54:37 +0000 (10:54 +0000)] 
Bug fix in sqlite3_analyzer: for databases larger than 1GiB, take into
account the lock-byte page when calculating the number of freelist pages.

FossilOrigin-Name: 26a909cdd32afee0f15968ca6f611eb259373b2a2195d0b3d47cfba103f1e6d6

2 years agoEarlier detection of a host of errors in CREATE TABLE, such the CREATE TABLE
drh [Fri, 13 Oct 2023 22:19:23 +0000 (22:19 +0000)] 
Earlier detection of a host of errors in CREATE TABLE, such the CREATE TABLE
statement itself fails, rather than generating an error on the first attempted
use of the created table.

FossilOrigin-Name: 348fa7aaf7958b3fb689ed023d946064ae8d92718a497a346e95114a2410cbf5

2 years agoApply the correct affinity to DEFAULT values that are TRUE or FALSE.
drh [Fri, 13 Oct 2023 19:41:20 +0000 (19:41 +0000)] 
Apply the correct affinity to DEFAULT values that are TRUE or FALSE.

FossilOrigin-Name: 4958db70c8103e249748fdeffc35f1c385e2e550e8a48697b82fcd797f3016be

2 years agoDo not allow triggers on shadow tables under defensive mode.
drh [Fri, 13 Oct 2023 18:29:18 +0000 (18:29 +0000)] 
Do not allow triggers on shadow tables under defensive mode.

FossilOrigin-Name: 44b932ff16e35814febd842d11215cf243393f173aade33ceded473598221e88

2 years agoFix an fts5 problem caused by a 'rebuild' followed by a DELETE in secure-delete mode.
dan [Fri, 13 Oct 2023 15:59:11 +0000 (15:59 +0000)] 
Fix an fts5 problem caused by a 'rebuild' followed by a DELETE in secure-delete mode.

FossilOrigin-Name: 18be505c628d9b13431ca6cfe822d4aeae119c53ae08aef26a67f310a8bd7bd3

2 years agoImmediately fail a CREATE TABLE statement that attempts to create a
drh [Fri, 13 Oct 2023 13:49:46 +0000 (13:49 +0000)] 
Immediately fail a CREATE TABLE statement that attempts to create a
table that has a generated column loop.  Legacy allows the table to be
created but the table would not be usable for anything.

FossilOrigin-Name: 3237bf964117c1ef71143042837ef21872bb3d04bfd682075672e768953ec802

2 years agoActually prevent PRAGMA writable_schema=ON from being set in defensive mode,
drh [Fri, 13 Oct 2023 12:57:23 +0000 (12:57 +0000)] 
Actually prevent PRAGMA writable_schema=ON from being set in defensive mode,
rather than just preventing it from functioning.

FossilOrigin-Name: 2b574d9e7e922d0961ea27bfc0148d3098157ff8d4feefba469489c81d43f3e0

2 years agoRound one of an audit for SQLITE_ENABLE_API_ARMOR for functions exposed by JNI and...
stephan [Fri, 13 Oct 2023 12:48:35 +0000 (12:48 +0000)] 
Round one of an audit for SQLITE_ENABLE_API_ARMOR for functions exposed by JNI and those functions missing armor, as [forum:5e3fc453a69b49ca|reported in several forum posts].

FossilOrigin-Name: 8c25c4b18ad07861bf0e47f99f3db04b569b9b859ad0690602f748ddf3576939

2 years agoAvoid potential overflow in hex(). [forum:/forumpost/7ac0c9c5ea|See forum post 7ac0c9...
larrybr [Fri, 13 Oct 2023 01:39:47 +0000 (01:39 +0000)] 
Avoid potential overflow in hex(). [forum:/forumpost/7ac0c9c5ea|See forum post 7ac0c9c5ea.]

FossilOrigin-Name: 2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032

2 years agoMake sure virtual tables have been connected before trying to invoke
drh [Thu, 12 Oct 2023 20:51:17 +0000 (20:51 +0000)] 
Make sure virtual tables have been connected before trying to invoke
the xIntegrity method during PRAGMA integrity_check.

FossilOrigin-Name: 4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da

2 years agoFix a problem with an fts5 secure-delete on a rowid/term pair that follows a legacy...
dan [Thu, 12 Oct 2023 19:46:58 +0000 (19:46 +0000)] 
Fix a problem with an fts5 secure-delete on a rowid/term pair that follows a legacy delete of the same pair.

FossilOrigin-Name: 579aea0c28e01a79620ac758edc02db3a01baaa073e7773b8f0b6f610479520b

2 years agoEnable SQLITE_VTAB_INNOCUOUS for FTS3, FTS5, and RTREE.
drh [Thu, 12 Oct 2023 18:46:27 +0000 (18:46 +0000)] 
Enable SQLITE_VTAB_INNOCUOUS for FTS3, FTS5, and RTREE.

FossilOrigin-Name: f34c533b6c1f8ef3f69c75c1039406c12751cdde1fbdcb4d9776b24455facf8a

2 years agoAdd test case for [29937081].
dan [Thu, 12 Oct 2023 18:09:27 +0000 (18:09 +0000)] 
Add test case for [29937081].

FossilOrigin-Name: d3b983edf7164d30ddb8b4b745a3feff9737149d85b1c428d6ad488ac6a1960a

2 years 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

2 years 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

2 years 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

2 years agoAdd the tokendata=1 option to ignore trailing token-data when querying an fts5 table.
dan [Wed, 11 Oct 2023 21:08:12 +0000 (21:08 +0000)] 
Add the tokendata=1 option to ignore trailing token-data when querying an fts5 table.

FossilOrigin-Name: 122935182ad5869ce3a4c6d796c38a0509f6f3384dd1b3e60a3f2f0f366cc5f5

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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