drh
11e8242e2e
Both json_remove() jsonb_remove() work on pure JSONB as long as the input
...
is JSONB.
FossilOrigin-Name: 68d551730be0a3ea9579646ed4836c73554c83ca7f2303b69a18843f1750f1a7
2023-11-15 20:32:06 +00:00
drh
af0c9ffb4a
The jsonb_remove() routine now appears to be working.
...
FossilOrigin-Name: e76d48137ea823b7810dc8c3b70eb21adabdd6cfbac36050c85d1375e94be1de
2023-11-15 18:47:31 +00:00
drh
0399994759
Work toward getting jsonb_remove() to work directly on JSONB blobs.
...
FossilOrigin-Name: a79ff8e58fcaf718a6fb78e145117f1d6d40d133f31e9752bb9c6d484850a27b
2023-11-15 16:10:31 +00:00
drh
e8d4fd59e4
Merge recent trunk enhancements and fixes into the jsonb branch.
...
FossilOrigin-Name: 091a5f058dfe2115fb9213655b34f00bcec80aebb299b571975cfe4ecd5ec206
2023-11-10 18:59:23 +00:00
drh
3839dcf973
Add the SQLITE_RESULT_SUBTYPE flag for application-defined functions. Add
...
the -DSQLITE_STRICT_SUBTYPE=1 compile-time option that raises an error if
any function invokes sqlite3_result_subtype() without the SQLITE_RESULT_SUBTYPE
flag. SQLITE_RESULT_SUBTYPE prevents an indexed value of that function from
being used to replace an equivalent expression, since the indexed expression
does not carry the subtype. Fix for the problem described at
[forum:/forumpost/68d284c86b082c3e|forum post 68d284c86b082c3e].
FossilOrigin-Name: ba789a7804ab96d81b15d6ef6fed1f802fa69db47cf91d368933e55289fa1d6e
2023-11-09 17:36:37 +00:00
drh
b10c3d32e0
Fixes: (1) In the ->> function, instead of setting a subtype and clearing it,
...
do not set it in the first place, as doing the set would trigger an error
under SQLITE_STRICT_SUBTYPE. (2) Allow the SQLITE_STRICT_SUBTYPE through
the property filter on sqlite3_create_function().
FossilOrigin-Name: 6195468b14f6f17ea072cf191c9ef1bd0713acd314bc6dc128be7322bfd612cc
2023-11-09 15:01:56 +00:00
drh
194b8d514b
Omit the new SQLITE_VALUE_SUBTYPE name. Stay with legacy SQLTIE_SUBTYPE.
...
Add extra documentation to sqlite3_value_subtype() and sqlite3_result_subtype()
indicating that the SQLITE_SUBTYPE and SQLITE_RESULT_SUBTYPE properties are
required on functions that use those interfaces.
FossilOrigin-Name: 563ad3be60d22c45f1c5b9a3e67738593f8b38f137147c56514166fbabf95365
2023-11-09 12:08:16 +00:00
drh
c060b5f3a8
JSON5 bug fix: Escape double-quotes that occur inside of single-quoted strings.
...
[forum:/forumpost/ddcad3e884|Forum post ddcad3e884].
FossilOrigin-Name: 1c98d46d60ef1494bd8b7561c7d0cd5aafc178201a6f1f0da25dea6140b91cd0
2023-11-09 01:54:26 +00:00
drh
243f2ec6a1
Make a distinction between functions that consume subtypes and functions
...
that generate subtypes.
FossilOrigin-Name: 48a92e3ad855227188a4c5afe4abbb7171761cf6fc930660084d9abeecfd91d9
2023-11-08 21:38:30 +00:00
drh
a4cf38ca9b
Merge recent trunk enhancements into the jsonb branch, and especially the
...
finer-grain characterization of JSON function properties.
FossilOrigin-Name: 72393b003f9f8675e4a124dddd09607b5b34ddefe56716b283c68c0982fb3d96
2023-11-08 17:11:13 +00:00
drh
b494366370
More precise characterization of JSON functions. Indicate when functions might
...
return JSON (subtype 'J') and when they make use of the function argument cache.
FossilOrigin-Name: b2b62546c4a5e9dccb8aa0cb8eda228d662c69159e320b01a377317bc909e89f
2023-11-08 16:37:12 +00:00
drh
7b5123c796
Enhance the JSONB lookup routine with logic to apply edits. The new logic is
...
currently unused and hence untested but does not create any regressions.
FossilOrigin-Name: b12110276fc15d1b6b0cc455f89747ace7a09650d5ba433d8bb431bb4e5bc951
2023-11-03 12:09:22 +00:00
drh
f5e487d168
Merge recent trunk enhancements into the jsonb branch.
...
FossilOrigin-Name: f47a8d0a207a8442a7f621b070ce9dd1d6013ce26bcf68165d20bb379bd478a0
2023-10-19 20:46:22 +00:00
drh
43dc31cf1f
Fix a harmless compiler warning about variant types for a pointer function.
...
FossilOrigin-Name: 37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289
2023-10-17 19:33:52 +00:00
drh
52d934e316
Fix a JSON bug introduced by the optimization of [df099ad713011b67] and
...
first appearing in 3.43.0. The problem occurs when doing a JSON_EXTRACT()
on an array element that was added by JSON_SET() without first reparsing.
Reported by [forum:/forumpost/fc0e3f1e2a|forum post fc0e3f1e2a].
FossilOrigin-Name: e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58
2023-10-17 13:41:41 +00:00
drh
ac4aea5102
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
2023-10-11 17:24:31 +00:00
drh
7d1c9da62d
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
2023-10-11 17:21:16 +00:00
drh
86db4555ca
Fix a missing zero-terminator on a string when processing
...
JSON aggregates into JSONB.
FossilOrigin-Name: fb81d570a3d9b8f55e9f278d5240605c5d0f3c5abde51550797999d03cf193a7
2023-10-11 13:19:37 +00:00
drh
2b7a1f5926
Fix an issue that can arise when processing corrupt JSONB.
...
FossilOrigin-Name: e50045c22296be84c6bea82bb8b310f07bca820c84d4a7349b16da0cf5d2657c
2023-10-11 12:44:17 +00:00
drh
33b56217cb
Improved robustness against corrupt JSONB.
...
FossilOrigin-Name: 0fbda92bb0eeb40f95c83f717e4e8f5bff1ac82f1c899e9f6d400d67df67214e
2023-10-11 12:21:29 +00:00
drh
2a96a1584d
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
2023-10-11 11:42:06 +00:00
drh
71dc3c714b
Improved robustness in the decoding of JSON5 text escape sequences found
...
in malformed JSONB.
FossilOrigin-Name: 35e0108af2bdd830375c31c525f8ed0e8df64959d89649a88402dc1a5c376612
2023-10-10 23:02:31 +00:00
drh
6b7b23c580
Fix an off-by-one error in the changes from the previous check-in on
...
the jsonb branch.
FossilOrigin-Name: 216191b113da43516d31301fb133173add66358d503677ab997bc82cc88bfea4
2023-10-10 18:55:29 +00:00
drh
59ded6b5f1
Improved robustness when translating corrupt JSONB into JSON text.
...
FossilOrigin-Name: 0caa320d9099adbaf98e3719003dbdc4d158abcb3d8a1af20fbcd4c08c970f4a
2023-10-10 18:42:08 +00:00
drh
d88f378c7d
Fix a potential buffer overrun due to corrupt JSONB.
...
FossilOrigin-Name: 5cbb861fc6cb7421a81c957ba9d576e0ae92cb4ed725cdb539b364d66f4ee145
2023-10-10 18:32:14 +00:00
drh
064c1688da
Fix bugs uncovered by the fuzzer.
...
FossilOrigin-Name: c96eb7fb618dc0a5aeec8a5e85076475b77dcd56309438aba1f9bddfc8921e3c
2023-10-10 18:04:40 +00:00
drh
f32aa34346
Systematize the names of some of the translation function in the JSON
...
implementation.
FossilOrigin-Name: db44bd1d62084ef69c808f7d07e0a25d5a089dcb8b98b1b5d026777591bbdefc
2023-10-09 18:33:01 +00:00
drh
0dead8d3d1
Merge the latest trunk fixes and enhancements into the jsonb branch, and
...
especially the JSON cache spill UAF fix.
FossilOrigin-Name: 9422c24f4a8b290dcae61e50ec81be5b314b22c61a2bca1e194e47da1316b6e6
2023-10-09 12:57:03 +00:00
drh
faef28e6bd
Fix a potential UAF caused by JSON parser cache spill.
...
[forum:/forumpost/b25edc1d46|Forum post b25edc1d46].
FossilOrigin-Name: a163fecca90cab9d1b7bf8ebac78d498775eed7b6d81e7920e3401633c3a4b60
2023-10-09 12:46:53 +00:00
drh
a7e9386e88
Remove some unnecessary code. Report errors for invalid JSONB input on
...
an extract.
FossilOrigin-Name: cbea16c29eb0507f39b5a1cf744a3bb9bb7c71ac156e84a19d03a37cb1816891
2023-10-07 23:35:07 +00:00
drh
de8ccf00fb
The return from sqlite3_value_blob() in jsonFuncArgMightBeBinary() might
...
be a NULL pointer. Check for that case.
FossilOrigin-Name: 7b52b266b066f1385144c1103a3a411306db5f44568366ae1e93cd8cce799bbc
2023-10-07 19:46:22 +00:00
drh
3efb2c4791
Improved detection of malformed JSONB when parsing it into a JsonNode array.
...
FossilOrigin-Name: ed99a788415e1f8375bd5ec004dd18b1cd0fae4aa94558170882ca487f6dff93
2023-10-07 19:40:20 +00:00
drh
f26833d783
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
2023-10-07 19:05:10 +00:00
drh
1244b6cbf6
Improvements to error messages returned when the ->> operator fails.
...
FossilOrigin-Name: 2f3388f14c843f1c02926e8b929365c06c1f1f4ea6fe6316092c3799c14549d3
2023-10-07 17:50:06 +00:00
drh
bae197c175
Improved error messages from search on JSONB.
...
FossilOrigin-Name: 96cfdc31e305406123f6ef1b920423f71902dc4b34381c3efb720274343d37cc
2023-10-07 11:36:16 +00:00
drh
522e880bc2
Report unknown JSONB element type when parsing JSONB into JsonNode.
...
FossilOrigin-Name: 1f4d3268257bda234c66c3767451b3d39d7b4c7c73a779ad396d9dfc5315905c
2023-10-07 09:13:59 +00:00
drh
11aa2adca3
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
2023-10-06 23:02:06 +00:00
drh
6b8aa95c3c
Improved error detection for JSONB inputs.
...
FossilOrigin-Name: 6945e11aa441ace52b93cdbb81ac45b6f809987f3dbc522251e63f8cb948fddd
2023-10-06 22:16:09 +00:00
drh
7b4349735f
Incremental improvements to the JSONB logic.
...
FossilOrigin-Name: fe326829c27715e249f727ba797c7df6491e874ec205a0a82ee09c78d61c6e1f
2023-10-06 18:21:47 +00:00
drh
98dbfa69d3
Fixes to rendering JSON5 extensions encoded as JSONB.
...
FossilOrigin-Name: 5a17e4479aad2d8313170e5de83a1c52f30b55d9d4fb776024fa6622e175c63b
2023-10-06 15:35:42 +00:00
drh
e690d5ad80
Fix compiler warnings.
...
FossilOrigin-Name: 5227add3c8d509de2e081249163fafdf30ac3173a6d710957f3c3b6f03e7017e
2023-10-06 14:59:40 +00:00
drh
e1e2f2dcc5
Improvements to error handling.
...
FossilOrigin-Name: b41dd237fb6c0dd7daedeaaf81dbc4fdb31cf511fd32cd3d4ee69db34e389915
2023-10-06 14:52:49 +00:00
drh
91f3cd9874
Merge compiler warning fixes from trunk into the jsonb branch.
...
FossilOrigin-Name: 6409d307915f8969f12df2d5ffa961645bd4db7ccfbd6f52237a217b6a867252
2023-10-06 13:05:42 +00:00
drh
1935887a68
Ensure that all fields of static sqlite3_module objects are explicitly
...
initialized, in order to hush-up nuisance compiler warnings.
FossilOrigin-Name: f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7
2023-10-06 12:51:05 +00:00
drh
dd7f09e6c0
Improvements to coping with malformed JSONB.
...
FossilOrigin-Name: 563cde404cec4c6559ae0c5fc5edbc878fee874b36562ce2fac5049cc8349343
2023-10-06 00:06:26 +00:00
drh
27401d38d8
Better error detection when doing a lookup on a JSONB.
...
FossilOrigin-Name: 6e8e0eedbf06e175af6ef230f1ce9a5ad84698b1c6dcd2794d878c746e7b6be4
2023-10-05 23:05:35 +00:00
drh
f7af8f3270
Improvements to comments. No changes to code.
...
FossilOrigin-Name: ac74d7877685006e43684edd6a2d22be8c9857f9f9eb52fc5b3c182d5e2fdb8d
2023-10-05 22:52:43 +00:00
drh
dac2707152
Turn an unreachable branch into an assert().
...
FossilOrigin-Name: 0f75199160e48fa8c44f986f1af777adf19e40fbd114a6f58e24d5e6dede779d
2023-10-05 20:17:01 +00:00
drh
51d507d432
Fix the parsing of non-standard "Infinity" and "NaN" values from text into
...
JSONB.
FossilOrigin-Name: df1fbbeb83a2b4a496c9de0d86c7c8c677f8fe3bc770da163dcc1d338a17b58b
2023-10-05 18:33:19 +00:00
drh
5b6cfb7906
Change the json_valid(X) routine to return true whenever X is a blob that
...
could plausibly be a valid JSONB.
FossilOrigin-Name: 425f0b85a6f8ad0604c4a5faa18efb90436fedb1fe2612a559147c62cff8b7e7
2023-10-05 18:09:12 +00:00