diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-15 10:11:23 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-15 10:11:23 +0200 |
commit | 8c21dc52ee4154e6326221752d70bbc309266861 (patch) | |
tree | cf7298fd50f0d2c4a17272cf550c67b09223d82d /mysql-test/main | |
parent | faddcf3c395da640b760c3f701f5bc1f3baae6c4 (diff) | |
parent | 6d90d2ba7f86bf95823f74ca2da433193ae84b25 (diff) | |
download | mariadb-git-8c21dc52ee4154e6326221752d70bbc309266861.tar.gz |
Merge branch '10.3' into bb-10.3-release
Diffstat (limited to 'mysql-test/main')
-rw-r--r-- | mysql-test/main/func_json.result | 27 | ||||
-rw-r--r-- | mysql-test/main/func_json.test | 19 |
2 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 48ce7ed1b3f..4d04871c806 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1016,5 +1016,32 @@ j {"ID": "4", "Name": "Betty", "Age": 19} drop table t1; # +# MDEV-27151: JSON_VALUE() does not parse NULL properties properly +# +# +# It is correct for JSON_EXTRACT() to give null instead of "NULL" because +# it returns the json literal that is put inside json. +# Hence it should return null as in 'null' string and not SQL NULL. +# JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL +# +SELECT NULL; +NULL +NULL +SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest'); +JSON_VALUE('{"nulltest": null}', '$.nulltest') +NULL +SELECT 1 + NULL; +1 + NULL +NULL +SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest'); +1 + JSON_VALUE('{"nulltest": null}', '$.nulltest') +NULL +SELECT NULL; +NULL +NULL +SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a'); +JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a') +null +# # End of 10.3 tests # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 9a063adc2cb..33e67d35f86 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -628,5 +628,24 @@ SELECT * FROM t1 WHERE JSON_EXTRACT(j, '$.Age')=19; drop table t1; --echo # +--echo # MDEV-27151: JSON_VALUE() does not parse NULL properties properly +--echo # +--echo # +--echo # It is correct for JSON_EXTRACT() to give null instead of "NULL" because +--echo # it returns the json literal that is put inside json. +--echo # Hence it should return null as in 'null' string and not SQL NULL. +--echo # JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL +--echo # + +SELECT NULL; +SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest'); +SELECT 1 + NULL; +SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest'); + + +SELECT NULL; +SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a'); + +--echo # --echo # End of 10.3 tests --echo # |