1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to work

Use JSON_COMPACT(X) instead of CAST(X AS JSON).
Bonus - X is validated to be a valid JSON.
Fix a typo in the error message.
This commit is contained in:
Sergei Golubchik
2017-02-14 11:11:47 +01:00
parent e0fa2ce40f
commit 6f6d0531dc
11 changed files with 636 additions and 633 deletions

View File

@@ -161,10 +161,10 @@ select json_unquote('abc');
select json_object("a", json_object("b", "abcd"));
select json_object("a", '{"b": "abcd"}');
select json_object("a", cast('{"b": "abcd"}' as json));
select json_object("a", json_compact('{"b": "abcd"}'));
select cast(NULL AS JSON);
select json_depth(cast(NULL as JSON));
select json_compact(NULL);
select json_depth(json_compact(NULL));
select json_depth('[[], {}]');
select json_depth('[[[1,2,3],"s"], {}, []]');
select json_depth('[10, {"a": 20}]');