diff options
Diffstat (limited to 'mysql-test/main/type_json.test')
-rw-r--r-- | mysql-test/main/type_json.test | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/mysql-test/main/type_json.test b/mysql-test/main/type_json.test index bd13dc1fcf4..38754ba6e1e 100644 --- a/mysql-test/main/type_json.test +++ b/mysql-test/main/type_json.test @@ -64,3 +64,63 @@ drop table t1; select cast('{a:1}' as text); --error ER_PARSE_ERROR select cast('{a:1}' as json); + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY +--echo # + +SET NAMES utf8; +CREATE TABLE t1 ( + js0 JSON, + js1 TEXT CHECK (JSON_VALID(js1)), + js2 TEXT CHECK (LENGTH(js2) > 0 AND JSON_VALID(js2)), + js3 TEXT CHECK (LENGTH(js2) > 0 OR JSON_VALID(js2)) +) CHARACTER SET utf8; +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT * FROM t1; +SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1; +--disable_metadata +--enable_ps_protocol +--enable_view_protocol +DROP TABLE t1; + + +--echo # +--echo # MDEV-27361 Hybrid functions with JSON arguments do not send format metadata +--echo # + +CREATE TABLE t1 (a JSON); +INSERT INTO t1 VALUES ('{"a":"b"}'); +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; +SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; +SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; +--disable_metadata +--disable_ps_protocol +--enable_view_protocol +DROP TABLE t1; + + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL; +--disable_metadata +--disable_ps_protocol +--enable_view_protocol + +--echo # +--echo # End of 10.5 tests +--echo # |