summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2023-05-02 16:34:07 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2023-05-03 12:33:11 +0530
commit4e5b771e980edfdad5c5414aa62c81d409d585a4 (patch)
tree4025c5b267b38a81b718de56ac92cf1942af4999 /mysql-test/main
parent97675570ca1e5a3428be1bf6d125f401e37e539d (diff)
downloadmariadb-git-11.1.tar.gz
MDEV-30677: Incorrect result for "SELECT JSON_SCHEMA_VALID('{}', NULL)"HEAD11.1
Analysis: null_value is not set if any one of the arguments is NULL. So it returns 1. Fix: when either argument is NULL, set null_value to true, so that null can be returned
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/func_json.result12
-rw-r--r--mysql-test/main/func_json.test7
2 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index afff2c58421..bdda00e256d 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -4704,4 +4704,16 @@ JSON_SCHEMA_VALID(json_object(), repeat('[', 10000000))
0
Warnings:
Warning 4040 Limit of 32 on JSON nested structures depth is reached in argument 2 to function 'json_schema_valid' at position 32
+#
+# MDEV-30677: Incorrect result for "SELECT JSON_SCHEMA_VALID('{}', NULL)"
+#
+SELECT JSON_SCHEMA_VALID('{}', NULL);
+JSON_SCHEMA_VALID('{}', NULL)
+NULL
+SELECT JSON_SCHEMA_VALID(NULL, '{}');
+JSON_SCHEMA_VALID(NULL, '{}')
+NULL
+SELECT JSON_SCHEMA_VALID(NULL, NULL);
+JSON_SCHEMA_VALID(NULL, NULL)
+NULL
# End of 11.1 test
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index e0da9819785..7fc2f05a57a 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -3586,4 +3586,11 @@ SELECT JSON_SCHEMA_VALID(repeat('[', 100000), json_object());
SELECT JSON_SCHEMA_VALID(json_object(), repeat('[', 10000000));
+--echo #
+--echo # MDEV-30677: Incorrect result for "SELECT JSON_SCHEMA_VALID('{}', NULL)"
+--echo #
+SELECT JSON_SCHEMA_VALID('{}', NULL);
+SELECT JSON_SCHEMA_VALID(NULL, '{}');
+SELECT JSON_SCHEMA_VALID(NULL, NULL);
+
--echo # End of 11.1 test