[MDEV-32454] JSON test has problem in view protocol Created: 2023-10-12  Updated: 2024-01-20

Status: Stalled
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.4.31, 10.5.22, 10.6.15, 10.11.5, 11.0.3, 11.1.2, 11.2.1
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2

Type: Bug Priority: Critical
Reporter: Oleksandr Byelkin Assignee: Alexey Botchkov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-27871 View is created with wrong column nam... Stalled
relates to MDEV-28649 json_array(false) in the definition o... Stalled

 Description   

appeared that for a big part of func_json test view protocol was disabled. Here is problem with it

--- /home/sanja/maria/git/10.4/mysql-test/main/func_json.result	2023-10-12 19:46:14.967079104 +0200
+++ /home/sanja/maria/git/10.4/mysql-test/main/func_json.reject	2023-10-12 19:46:38.123111870 +0200
@@ -226,7 +226,7 @@
 [[3, 4]]
 select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp;
 exp
-{"a": 1, "b": {"c": 1, "k1": "word"}, "d": [1, 2]}
+{"a": 1, "b": {"c": 1, "k1": "word"}, "d":
 select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp;
 exp
 {"a": 1, "b": {"c": 1}, "d": [1, 2, 3]}
@@ -238,7 +238,7 @@
 {"a": 1, "b": {"c": 1}, "d": [1, 2]}
 select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
 exp
-{"a": 10, "b": [2, 3], "c": "[true, false]"}
+{"a": 10, "b": [2, 3], "c": "[true,
 select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
 exp
 {"a": 10, "b": [2, 3]}
@@ -335,19 +335,19 @@
 [1, 2, {"id": 47}]
 select json_type('{"k1":123, "k2":345}');
 json_type('{"k1":123, "k2":345}')
-OBJECT
+OBJE
 select json_type('[123, "k2", 345]');
 json_type('[123, "k2", 345]')
-ARRAY
+ARRA
 select json_type("true");
 json_type("true")
-BOOLEAN
+BOOL
 select json_type('123');
 json_type('123')
-INTEGER
+INTE
 select json_type('123.12');
 json_type('123.12')
-DOUBLE
+DOUB
 select json_keys('{"a":{"c":1, "d":2}, "b":2}');
 json_keys('{"a":{"c":1, "d":2}, "b":2}')
 ["a", "b"]
@@ -404,10 +404,10 @@
 drop table t1;
 select json_unquote('"abc"');
 json_unquote('"abc"')
-abc
+a
 select json_unquote('abc');
 json_unquote('abc')
-abc
+a
 create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1;
 insert into t1 values ('abc'),('def');
 select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
@@ -420,7 +420,7 @@
 {"a": {"b": "abcd"}}
 select json_object("a", '{"b": "abcd"}');
 json_object("a", '{"b": "abcd"}')
-{"a": "{\"b\": \"abcd\"}"}
+{"a": "{\"b\": \"abcd\"}
 select json_object("a", json_compact('{"b": "abcd"}'));
 json_object("a", json_compact('{"b": "abcd"}'))
 {"a": {"b": "abcd"}}
@@ -596,7 +596,7 @@
 {"a":1,"b":[1,2,3],"c":{"aa":"v1","bb":"v2"}}
 select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
 ex
-{"a": 1, "b": [1, 2, 3], "c": {"aa": "v1", "bb": "v2"}}
+{"a": 1, "b": [1, 2, 3], "c": {"aa": "v1", "bb": 
 select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
 ex
 {
@@ -604,15 +604,7 @@
     "b": 
     [
         1,
-        2,
-        3
-    ],
-    "c": 
-    {
-        "aa": "v1",
-        "bb": "v2"
-    }
-}
+        
 SELECT JSON_search( '{"x": "\\""}', "one", '"') as ex;
 ex
 "$.x"
@@ -785,13 +777,13 @@
 #
 SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp;
 exp
-{"a": "�"}
+{"a": "�"
 SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp;
 exp
-{"a": "�", "b": "�"}
+{"a": "�", "b"
 SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp;
 exp
-{"a": "�", "x": 1, "b": "�"}
+{"a": "�", "x": 1, "b
 #
 # MDEV-17121 JSON_ARRAY_APPEND
 #
@@ -969,18 +961,18 @@
 JSON_CONTAINS('{"A": 0, "B": {"C": 1}, "D": 2}', '2', '$.A') AS ison_contains,
 JSON_CONTAINS_PATH('{"A": 1, "B": [2], "C": [3, 4]}', 'one', '$.A', '$.D') AS json_contains_path;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					json_valid	3	1	1	Y32896	0	63
-def					json_exists	3	1	1	Y32896	0	63
-def					ison_contains	3	1	1	Y32896	0	63
-def					json_contains_path	3	1	1Y	32896	0	63
+def			mysqltest_tmp_v	json_valid	json_valid	3	11	Y	32768	0	63
+def			mysqltest_tmp_v	json_exists	json_exists	3	11	Y	32768	0	63
+def			mysqltest_tmp_v	ison_contains	ison_contains	3	11	Y	32768	0	63
+def			mysqltest_tmp_v	json_contains_path	json_contains_path	3	1	1	Y	32768	0	63
 json_valid	json_exists	ison_contains	json_contains_path
 1	1	0	1
 SELECT
 JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
 JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					json_length	3	10	1	Y32896	0	63
-def					json_depnth	3	10	1	N32897	0	63
+def			mysqltest_tmp_v	json_length	json_length	3	10	1	Y	32768	0	63
+def			mysqltest_tmp_v	json_depnth	json_depnth	3	10	1	N	32769	0	63
 json_length	json_depnth
 2	3
 #
@@ -1052,9 +1044,9 @@
 JSON_OBJECT("cond", true) AS j1,
 JSON_OBJECT("cond", COALESCE(true, false)) j2,
 JSON_OBJECT("cond", COALESCE(COALESCE(true, false))) j3;
-j1	{"cond": true}
-j2	{"cond": true}
-j3	{"cond": true}
+j1	{"cond": 1}
+j2	{"cond": 1}
+j3	{"cond": 1}
 CREATE TABLE t1 (a INT);
 INSERT INTO t1 VALUES (1),(2),(3);
 SELECT JSON_OBJECT('x',(SELECT MAX(a)=4 FROM t1));

as test ancomment all protocol disabling marked #enable after MDEV-32454 fix



 Comments   
Comment by Oleksandr Byelkin [ 2023-10-25 ]

in 10.5 adds this:

--- /home/sanja/maria/git/10.5/mysql-test/main/func_json.result	2023-10-19 09:46:53.360875093 +0200
+++ /home/sanja/maria/git/10.5/mysql-test/main/func_json.reject	2023-10-25 09:03:42.397275678 +0200
@@ -1175,7 +1175,7 @@
 [1,0]	[1,1]
 SELECT JSON_ARRAYAGG(TRUE), JSON_ARRAYAGG(FALSE) FROM t1;
 JSON_ARRAYAGG(TRUE)	JSON_ARRAYAGG(FALSE)
-[true,true,true,true]	[false,false,false,false]
+[1,1,1,1]	[0,0,0,0]
 DROP TABLE t1;
 #
 # Aggregation of strings with quoted
@@ -1564,7 +1564,7 @@
 insert into t1 values (concat('x64-', repeat('c', 60)));
 select json_arrayagg(a) from t1;
 json_arrayagg(a)
-["x64-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
+["x64-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 Warnings:
 Warning	1260	Row 1 was cut by JSON_ARRAYAGG()
 drop table t1;

Comment by Oleksandr Byelkin [ 2023-10-26 ]

10.6

--- /mnt/buildbot/build/mariadb-10.6.16/mysql-test/main/func_json.result	2023-10-25 08:10:30.000000000 -0400
+++ /mnt/buildbot/build/mariadb-10.6.16/mysql-test/main/func_json.reject	2023-10-25 11:26:00.875950291 -0400
@@ -702,7 +702,7 @@
 {"foo": "bar`bar"}
 SELECT JSON_SET('{}', '$.age', 87);
 JSON_SET('{}', '$.age', 87)
-{"age": 87}
+{"age": 
 SELECT JSON_MERGE('[]', '{"c":"d"}');
 JSON_MERGE('[]', '{"c":"d"}')
 [{"c": "d"}]

Comment by Alexey Botchkov [ 2023-12-14 ]

Hi, Rucha!
Please take a look
https://github.com/MariaDB/server/commit/ccd760781ad18890993f02ffce264bbd87386079

Comment by Rucha Deodhar [ 2024-01-17 ]

looks ok to push after fixing the typo in title.

Generated at Thu Feb 08 10:31:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.