Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
10.2.11
-
None
-
Centos 7
Description
Using the following test table:
CREATE TABLE `test` (
|
`extra_info` BLOB NULL DEFAULT NULL
|
)
|
COLLATE='utf8_general_ci' |
ENGINE=InnoDB
|
;
|
|
INSERT INTO `test` VALUES (NULL, 1); |
And then running the following queries:
SELECT json_valid(null); # returns null, should return 1? |
SELECT json_valid('{}'); # returns 1 |
|
UPDATE test
|
SET extra_info = JSON_SET(extra_info, '$.service_supplier_id', 999) |
WHERE test_int = 1; |
I expect a new JSON document to be created as per JSON lint and RFC 7159 as per the following URL's as NULL is a valid JSON document.
https://stackoverflow.com/questions/8526995/is-null-valid-json-4-bytes-nothing-else
https://jsonlint.com/
This goes against the MariaDB documentation that states NULL will result in a NULL document:
Updates or inserts data into a JSON document, returning the result, or NULL if any of the arguments are NULL or the optional path fails to find an object.
I think MariaDB implements an older JSON standard preventing creation of a new document into a NULL column. Or is there another way to achieve the above JSON_SET to create a new document?