aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/json.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index ba701ba68..3c179ac16 100644
--- a/src/json.c
+++ b/src/json.c
@@ -4812,8 +4812,14 @@ static void jsonTypeFunc(
/*
** json_valid(JSON)
**
-** Return 1 if JSON is a well-formed canonical JSON string according
-** to RFC-7159. Return 0 otherwise.
+** Return 1 if the argument is one of:
+**
+** * A well-formed canonical JSON string according to RFC-8259
+** (without JSON5 enhancements), or
+**
+** * A BLOB that plausibly could be a JSONB value.
+**
+** Return 0 otherwise.
*/
static void jsonValidFunc(
sqlite3_context *ctx,
@@ -4829,6 +4835,10 @@ static void jsonValidFunc(
#endif
return;
}
+ if( jsonFuncArgMightBeBinary(argv[0]) ){
+ sqlite3_result_int(ctx, 1);
+ return;
+ }
p = jsonParseCached(ctx, argv[0], 0, 0);
if( p==0 || p->oom ){
sqlite3_result_error_nomem(ctx);