diff options
author | drh <> | 2023-11-21 22:36:32 +0000 |
---|---|---|
committer | drh <> | 2023-11-21 22:36:32 +0000 |
commit | cf72606a7d05c7fc3b51ba596db013d51eb73d4b (patch) | |
tree | 652cc6a5aa0d080564becfd77f66a8d64064518d /src/json.c | |
parent | 27fea97e4451ddb181a4d0cda5b6aeb1865159ea (diff) | |
download | sqlite-cf72606a7d05c7fc3b51ba596db013d51eb73d4b.tar.gz sqlite-cf72606a7d05c7fc3b51ba596db013d51eb73d4b.zip |
Inserts invalid JSONB should return "malformed JSON", not a json path error.
FossilOrigin-Name: 306ee66fbd0231a9f5b229e5630d5cc66c9cf08b466d2d9204e79e1f44a16374
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c index 69557aa72..54e221392 100644 --- a/src/json.c +++ b/src/json.c @@ -4427,7 +4427,7 @@ static void jsonInsertIntoBlob( int eEdit /* JEDIT_INS, JEDIT_REPL, or JEDIT_SET */ ){ int i; - u32 rc; + u32 rc = 0; const char *zPath = 0; int flgs; JsonParse px, ax; @@ -4471,7 +4471,11 @@ static void jsonInsertIntoBlob( jsonInsertIntoBlob_patherror: if( px.nBlobAlloc ) sqlite3_free(px.aBlob); - jsonPathSyntaxError(zPath, ctx); + if( rc==JSON_BLOB_ERROR ){ + sqlite3_result_error(ctx, "malformed JSON", -1); + }else{ + jsonPathSyntaxError(zPath, ctx); + } return; } |