From: drh <> Date: Wed, 8 Nov 2023 17:11:13 +0000 (+0000) Subject: Merge recent trunk enhancements into the jsonb branch, and especially the X-Git-Tag: version-3.45.0~116^2~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a4cf38ca9b9f2217b163888b3d4811e316e538c4;p=thirdparty%2Fsqlite.git Merge recent trunk enhancements into the jsonb branch, and especially the finer-grain characterization of JSON function properties. FossilOrigin-Name: 72393b003f9f8675e4a124dddd09607b5b34ddefe56716b283c68c0982fb3d96 --- a4cf38ca9b9f2217b163888b3d4811e316e538c4 diff --cc manifest index 9aadbdf941,d580ab0fb8..90388082d6 --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Enhance\sthe\sJSONB\slookup\sroutine\swith\slogic\sto\sapply\sedits.\s\sThe\snew\slogic\sis\ncurrently\sunused\sand\shence\suntested\sbut\sdoes\snot\screate\sany\sregressions. - D 2023-11-03T12:09:22.342 -C More\sprecise\scharacterization\sof\sJSON\sfunctions.\s\sIndicate\swhen\sfunctions\smight\nreturn\sJSON\s(subtype\s'J')\sand\swhen\sthey\smake\suse\sof\sthe\sfunction\sargument\scache. -D 2023-11-08T16:37:12.211 ++C Merge\srecent\strunk\senhancements\sinto\sthe\sjsonb\sbranch,\sand\sespecially\sthe\nfiner-grain\scharacterization\sof\sJSON\sfunction\sproperties. ++D 2023-11-08T17:11:13.302 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@@ -683,7 -684,7 +684,7 @@@ F src/hash.h 3340ab6e1d13e725571d7cee6d F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 - F src/json.c e109da4d5f29e239db837dad09a886a78b6a217592ea8c71e3b584483ce9b179 -F src/json.c 82d1237899d5d06dc9722f9a0d9305711ff563c68221b479f0788b33cb114e16 ++F src/json.c e745701b9859a0940f8314eb59e913685a98a606506deef004675b43129da840 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c e1bc8864834697503d370d94613be945d05ca1c5ebdda43e7d5c8ee8c48d433c @@@ -723,12 -724,12 +724,12 @@@ F src/printf.c 9da63b9ae1c14789bcae1284 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c d017bad7ba8e778617701a0e986fdeb393d67d6afa84fb28ef4e8b8ad2acf916 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 - F src/select.c 8ebbc67478e2d43f0b24c79258597646e526c5001d07801bba7d4059088c8b12 - F src/shell.c.in aebfbedaa7706d2c73ab7366a19fc8bc40ea68b70d2529f7feef54e6eb077ea2 - F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 + F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 + F src/shell.c.in 7312c571ebf518fc8927bbb5aeb4fa67e5b0dfb2adae4258dcd1ccae42c11e1f + F src/sqlite.h.in a0fce680a40fe81b13eae3749d001134d9fe0a43aecc09a8986520d5119acfcd F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 - F src/sqliteInt.h 707095a0591e02f4866ed9798cbdd97a8ae8cf4d98f061808944c2cd1c95d1a9 -F src/sqliteInt.h 90bbf1ba8f47753c84f15cdb0e5dc6267d3f391cc66b9fbd6f441881d1bf44a1 ++F src/sqliteInt.h 1412a692dfb5d615e416f3ddb9b33e5b6bd39f70432bb84046c50574fc604b51 F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@@ -793,13 -794,13 +794,13 @@@ F src/upsert.c fa125a8d3410ce9a97b02cb5 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c b22cc9f203a8c0b9ee5338a67f8860347d14845864c10248bebe84518a781677 F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 - F src/vdbe.c 4c76111311e06e74d2519f9cfee5caaaee722bf04559e16f4758a18a0c723b6c -F src/vdbe.c 7034cf3eec0c905df753368efbcdd96377fca0245584e66766ec47a29fe468c8 ++F src/vdbe.c 5f7432b22b66a09503caab15e86f582f7b55299e1d366799896ae3e354192f09 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c db190d007bdf5b9165edeb12369f4c59a459f88fd652c1671c1238862e662cc3 +F src/vdbeapi.c 22a2661a2886f6b142fce91e95533a1841135e8217f65297d7df353a0eddf650 - F src/vdbeaux.c dffcf79e7e415fcd6e4c8ac1ec7124cae5257018443adf09551c807655b04993 + F src/vdbeaux.c f3997b5956c8d97bd2fc3392db42caecddfa6549e9df82e0a7e5804653ca475a F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 - F src/vdbemem.c c936e9002af4993b84c4eb7133d6b1190efe46d391cc86117ecd67ba17b1a04b + F src/vdbemem.c 0012d5f01cc866833847c2f3ae4c318ac53a1cb3d28acad9c35e688039464cf0 F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7 @@@ -2142,8 -2139,8 +2140,8 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 - P b089bf46374b374d02d7654c65eb3e75d1777638b398061e47644af0dab48c9b - R 02d78f9919449761c67674ad6f60265a -P 3978c084a509c3c739fbe87e20feec9ddf1325e35170329987af197ca9fd731a -R 2a4b96e0d45f1ec3b63228c066f1d6da ++P b12110276fc15d1b6b0cc455f89747ace7a09650d5ba433d8bb431bb4e5bc951 b2b62546c4a5e9dccb8aa0cb8eda228d662c69159e320b01a377317bc909e89f ++R d8efa19343b75dfdaa31ac930f849ac1 U drh - Z f8a451c94f8b9175a3b99dd9c9c86acd -Z 7680e031e38ed1a9d942d233bb859fec ++Z 8a4148addede5d91729ce4e74e65d8c3 # Remove this line to create a well-formed Fossil manifest. diff --cc manifest.uuid index c8ced97e73,8ca67c6ccf..0529da599b --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - b12110276fc15d1b6b0cc455f89747ace7a09650d5ba433d8bb431bb4e5bc951 -b2b62546c4a5e9dccb8aa0cb8eda228d662c69159e320b01a377317bc909e89f ++72393b003f9f8675e4a124dddd09607b5b34ddefe56716b283c68c0982fb3d96 diff --cc src/json.c index e998af5230,407ca2d0eb..04349899c8 --- a/src/json.c +++ b/src/json.c @@@ -5859,37 -3804,30 +5859,43 @@@ static sqlite3_module jsonTreeModule = void sqlite3RegisterJsonFunctions(void){ #ifndef SQLITE_OMIT_JSON static FuncDef aJsonFunc[] = { - JFUNCTION(json, 1, 0, jsonRemoveFunc), - JFUNCTION(jsonb, 1, JSON_BLOB, jsonbFunc), - JFUNCTION(json_array, -1, 0, jsonArrayFunc), - JFUNCTION(jsonb_array, -1, JSON_BLOB, jsonArrayFunc), - JFUNCTION(json_array_length, 1, 0, jsonArrayLengthFunc), - JFUNCTION(json_array_length, 2, 0, jsonArrayLengthFunc), - JFUNCTION(json_error_position,1, 0, jsonErrorFunc), - JFUNCTION(json_extract, -1, 0, jsonExtractFunc), - JFUNCTION(jsonb_extract, -1, JSON_BLOB, jsonExtractFunc), - JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc), - JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc), - JFUNCTION(json_insert, -1, 0, jsonSetFunc), - JFUNCTION(jsonb_insert, -1, JSON_BLOB, jsonSetFunc), - JFUNCTION(json_object, -1, 0, jsonObjectFunc), - JFUNCTION(jsonb_object, -1, JSON_BLOB, jsonObjectFunc), - JFUNCTION(json_patch, 2, 0, jsonPatchFunc), - JFUNCTION(jsonb_patch, 2, JSON_BLOB, jsonPatchFunc), - JFUNCTION(json_quote, 1, 0, jsonQuoteFunc), - JFUNCTION(json_remove, -1, 0, jsonRemoveFunc), - JFUNCTION(jsonb_remove, -1, JSON_BLOB, jsonRemoveFunc), - JFUNCTION(json_replace, -1, 0, jsonReplaceFunc), - JFUNCTION(jsonb_replace, -1, JSON_BLOB, jsonReplaceFunc), - JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc), - JFUNCTION(jsonb_set, -1, JSON_ISSET|JSON_BLOB, jsonSetFunc), - JFUNCTION(json_type, 1, 0, jsonTypeFunc), - JFUNCTION(json_type, 2, 0, jsonTypeFunc), - JFUNCTION(json_valid, 1, 0, jsonValidFunc), - /* Uses cache ------, ,---- Might return JSON (subtype J) */ - /* Num args ________ | | ___ Flags */ - /* \ | | / */ - JFUNCTION(json, 1, 1, 1, 0, jsonRemoveFunc), - JFUNCTION(json_array, -1, 0, 1, 0, jsonArrayFunc), - JFUNCTION(json_array_length, 1, 1, 0, 0, jsonArrayLengthFunc), - JFUNCTION(json_array_length, 2, 1, 0, 0, jsonArrayLengthFunc), - JFUNCTION(json_error_position,1, 1, 0, 0, jsonErrorFunc), - JFUNCTION(json_extract, -1, 1, 1, 0, jsonExtractFunc), - JFUNCTION(->, 2, 1, 1, JSON_JSON, jsonExtractFunc), - JFUNCTION(->>, 2, 1, 0, JSON_SQL, jsonExtractFunc), - JFUNCTION(json_insert, -1, 1, 1, 0, jsonSetFunc), - JFUNCTION(json_object, -1, 0, 1, 0, jsonObjectFunc), - JFUNCTION(json_patch, 2, 1, 1, 0, jsonPatchFunc), - JFUNCTION(json_quote, 1, 0, 1, 0, jsonQuoteFunc), - JFUNCTION(json_remove, -1, 1, 1, 0, jsonRemoveFunc), - JFUNCTION(json_replace, -1, 1, 1, 0, jsonReplaceFunc), - JFUNCTION(json_set, -1, 1, 1, JSON_ISSET, jsonSetFunc), - JFUNCTION(json_type, 1, 1, 0, 0, jsonTypeFunc), - JFUNCTION(json_type, 2, 1, 0, 0, jsonTypeFunc), - JFUNCTION(json_valid, 1, 1, 0, 0, jsonValidFunc), ++ /* Might return JSON text (subtype J) */ ++ /* | */ ++ /* Uses cache ------, | ,---- Returns JSONB */ ++ /* | | | */ ++ /* Number of arguments ---, | | | ,--- Flags */ ++ /* | | | | | */ ++ JFUNCTION(json, 1, 1, 1, 0, 0, jsonRemoveFunc), ++ JFUNCTION(jsonb, 1, 1, 0, 1, 0, jsonbFunc), ++ JFUNCTION(json_array, -1, 0, 1, 0, 0, jsonArrayFunc), ++ JFUNCTION(jsonb_array, -1, 0, 0, 1, 0, jsonArrayFunc), ++ JFUNCTION(json_array_length, 1, 1, 0, 0, 0, jsonArrayLengthFunc), ++ JFUNCTION(json_array_length, 2, 1, 0, 0, 0, jsonArrayLengthFunc), ++ JFUNCTION(json_error_position,1, 1, 0, 0, 0, jsonErrorFunc), ++ JFUNCTION(json_extract, -1, 1, 1, 0, 0, jsonExtractFunc), ++ JFUNCTION(jsonb_extract, -1, 1, 0, 1, 0, jsonExtractFunc), ++ JFUNCTION(->, 2, 1, 1, 0, JSON_JSON, jsonExtractFunc), ++ JFUNCTION(->>, 2, 1, 0, 0, JSON_SQL, jsonExtractFunc), ++ JFUNCTION(json_insert, -1, 1, 1, 0, 0, jsonSetFunc), ++ JFUNCTION(jsonb_insert, -1, 1, 0, 1, 0, jsonSetFunc), ++ JFUNCTION(json_object, -1, 0, 1, 0, 0, jsonObjectFunc), ++ JFUNCTION(jsonb_object, -1, 0, 0, 1, 0, jsonObjectFunc), ++ JFUNCTION(json_patch, 2, 1, 1, 0, 0, jsonPatchFunc), ++ JFUNCTION(jsonb_patch, 2, 1, 0, 1, 0, jsonPatchFunc), ++ JFUNCTION(json_quote, 1, 0, 1, 0, 0, jsonQuoteFunc), ++ JFUNCTION(json_remove, -1, 1, 1, 0, 0, jsonRemoveFunc), ++ JFUNCTION(jsonb_remove, -1, 1, 0, 1, 0, jsonRemoveFunc), ++ JFUNCTION(json_replace, -1, 1, 1, 0, 0, jsonReplaceFunc), ++ JFUNCTION(jsonb_replace, -1, 1, 0, 1, 0, jsonReplaceFunc), ++ JFUNCTION(json_set, -1, 1, 1, 0, JSON_ISSET, jsonSetFunc), ++ JFUNCTION(jsonb_set, -1, 1, 0, 1, JSON_ISSET, jsonSetFunc), ++ JFUNCTION(json_type, 1, 1, 0, 0, 0, jsonTypeFunc), ++ JFUNCTION(json_type, 2, 1, 0, 0, 0, jsonTypeFunc), ++ JFUNCTION(json_valid, 1, 1, 0, 0, 0, jsonValidFunc), #if SQLITE_DEBUG - JFUNCTION(json_parse, 1, 0, jsonParseFunc), - JFUNCTION(json_test1, 1, 0, jsonTest1Func), - JFUNCTION(jsonb_test2, 1, 0, jsonbTest2), - JFUNCTION(json_parse, 1, 1, 0, 0, jsonParseFunc), - JFUNCTION(json_test1, 1, 1, 0, 0, jsonTest1Func), ++ JFUNCTION(json_parse, 1, 1, 0, 0, 0, jsonParseFunc), ++ JFUNCTION(json_test1, 1, 1, 0, 0, 0, jsonTest1Func), ++ JFUNCTION(jsonb_test2, 1, 1, 0, 1, 0, jsonbTest2), #endif WAGGREGATE(json_group_array, 1, 0, 0, jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse, diff --cc src/sqliteInt.h index 23beb48de3,20e23ed2bc..f14e67f125 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@@ -2113,10 -2113,10 +2113,10 @@@ struct FuncDestructor #define MFUNCTION(zName, nArg, xPtr, xFunc) \ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ xPtr, 0, xFunc, 0, 0, 0, #zName, {0} } - #define JFUNCTION(zName, nArg, iArg, xFunc) \ - {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|\ - SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ - SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } -#define JFUNCTION(zName, nArg, bUseCache, bSubtype, iArg, xFunc) \ ++#define JFUNCTION(zName, nArg, bUseCache, bSubtype, bJsonB, iArg, xFunc) \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_FUNC_CONSTANT|\ + SQLITE_UTF8|((bUseCache)*SQLITE_FUNC_RUNONLY)|((bSubtype)*SQLITE_SUBTYPE), \ - SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } ++ SQLITE_INT_TO_PTR(iArg|((bJsonB)*JSON_BLOB)),0,xFunc,0, 0, 0, #zName, {0} } #define INLINE_FUNC(zName, nArg, iArg, mFlags) \ {nArg, SQLITE_FUNC_BUILTIN|\ SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \