summaryrefslogtreecommitdiff
path: root/mysql-test/main/type_json.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/type_json.result')
-rw-r--r--mysql-test/main/type_json.result63
1 files changed, 63 insertions, 0 deletions
diff --git a/mysql-test/main/type_json.result b/mysql-test/main/type_json.result
index 7c8a9cbb113..681bd42c4e3 100644
--- a/mysql-test/main/type_json.result
+++ b/mysql-test/main/type_json.result
@@ -98,3 +98,66 @@ select cast('{a:1}' as text);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'text)' at line 1
select cast('{a:1}' as json);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json)' at line 1
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY
+#
+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;
+SELECT * FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 js0 js0 252 (format=json) 4294967295 0 Y 144 0 33
+def test t1 t1 js1 js1 252 (format=json) 196605 0 Y 16 0 33
+def test t1 t1 js2 js2 252 (format=json) 196605 0 Y 16 0 33
+def test t1 t1 js3 js3 252 196605 0 Y 16 0 33
+js0 js1 js2 js3
+SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 js0 js0 252 (format=json) 4294967295 0 Y 144 0 33
+def JSON_COMPACT(js0) 251 (format=json) 4294967295 0 Y 128 0 33
+def JSON_COMPACT('{}') 253 (format=json) 6 0 Y 0 0 33
+js0 JSON_COMPACT(js0) JSON_COMPACT('{}')
+DROP TABLE t1;
+#
+# MDEV-27361 Hybrid functions with JSON arguments do not send format metadata
+#
+CREATE TABLE t1 (a JSON);
+INSERT INTO t1 VALUES ('{"a":"b"}');
+SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 a a 252 (format=json) 4294967295 9 Y 144 0 33
+def JSON_COMPACT(a) 251 (format=json) 4294967295 9 Y 128 0 33
+def COALESCE(a) 251 (format=json) 4294967295 9 Y 128 39 33
+a JSON_COMPACT(a) COALESCE(a)
+{"a":"b"} {"a":"b"} {"a":"b"}
+SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def JSON_ARRAYAGG(1) 252 (format=json) 9437184 3 Y 0 0 33
+def JSON_ARRAYAGG(a) 252 (format=json) 12582912 11 Y 128 0 33
+JSON_ARRAYAGG(1) JSON_ARRAYAGG(a)
+[1] [{"a":"b"}]
+SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def JSON_OBJECTAGG('a','b') 252 (format=json) 9437184 9 Y 0 0 33
+def JSON_OBJECTAGG('a',a) 252 (format=json) 12582912 15 Y 128 0 33
+JSON_OBJECTAGG('a','b') JSON_OBJECTAGG('a',a)
+{"a":"b"} {"a":{"a":"b"}}
+DROP TABLE t1;
+#
+# MDEV-27018 IF and COALESCE lose "json" property
+#
+SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def j 250 (format=json) 9437283 16 Y 0 39 33
+j
+{"a": {"b":"c"}}
+#
+# End of 10.5 tests
+#