summaryrefslogtreecommitdiff
path: root/mysql-test/suite/json
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2017-02-10 01:05:27 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2017-02-10 01:05:27 +0400
commit25aaecb240d20547791cbbc06f1ccb3630782cd5 (patch)
tree453067cc842f869491e2fa77a5e7524017448fc7 /mysql-test/suite/json
parent3ae038b732ce503fb839e9095355e05f5c6866f9 (diff)
downloadmariadb-git-25aaecb240d20547791cbbc06f1ccb3630782cd5.tar.gz
MDEV-11858 json_merge() concatenates instead of merging.
Fix json_merge implementation.
Diffstat (limited to 'mysql-test/suite/json')
-rw-r--r--mysql-test/suite/json/r/json_no_table.result28
1 files changed, 14 insertions, 14 deletions
diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result
index 3201d0fc432..9ea5e94c96e 100644
--- a/mysql-test/suite/json/r/json_no_table.result
+++ b/mysql-test/suite/json/r/json_no_table.result
@@ -819,7 +819,7 @@ select json_merge( '[1, 2]', '[3, 4' );
json_merge( '[1, 2]', '[3, 4' )
NULL
Warnings:
-Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_merge'
+Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_merge'
error ER_INVALID_JSON_TEXT_IN_PARAM
select json_merge( '[1, 2', '[3, 4]' );
json_merge( '[1, 2', '[3, 4]' )
@@ -855,31 +855,31 @@ json_merge( '{ "a": 2 }', '[1, 2]' )
[{"a": 2}, 1, 2]
select json_merge( '{"a": 1, "b": 2 }', '{"b": 3, "d": 4 }' );
json_merge( '{"a": 1, "b": 2 }', '{"b": 3, "d": 4 }' )
-{"a": 1, "b": 2, "b": 3, "d": 4}
+{"a": 1, "b": [2, 3], "d": 4}
select json_merge( '{"a": 1, "b": 2 }', '{"b": [3, 4], "d": 4 }' );
json_merge( '{"a": 1, "b": 2 }', '{"b": [3, 4], "d": 4 }' )
-{"a": 1, "b": 2, "b": [3, 4], "d": 4}
+{"a": 1, "b": [2, 3, 4], "d": 4}
select json_merge( '{"a": 1, "b": [2, 3] }', '{"b": 4, "d": 4 }' );
json_merge( '{"a": 1, "b": [2, 3] }', '{"b": 4, "d": 4 }' )
-{"a": 1, "b": [2, 3], "b": 4, "d": 4}
+{"a": 1, "b": [2, 3, 4], "d": 4}
select json_merge( '{"a": 1, "b": 2 }', '{"b": {"e": 7, "f": 8}, "d": 4 }' );
json_merge( '{"a": 1, "b": 2 }', '{"b": {"e": 7, "f": 8}, "d": 4 }' )
-{"a": 1, "b": 2, "b": {"e": 7, "f": 8}, "d": 4}
+{"a": 1, "b": [2, {"e": 7, "f": 8}], "d": 4}
select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": 2 }' );
json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": 2 }' )
-{"b": {"e": 7, "f": 8}, "d": 4, "a": 1, "b": 2}
+{"b": [{"e": 7, "f": 8}, 2], "d": 4, "a": 1}
select json_merge( '{"a": 1, "b": [2, 9] }', '{"b": [10, 11], "d": 4 }' );
json_merge( '{"a": 1, "b": [2, 9] }', '{"b": [10, 11], "d": 4 }' )
-{"a": 1, "b": [2, 9], "b": [10, 11], "d": 4}
+{"a": 1, "b": [2, 9, 10, 11], "d": 4}
select json_merge( '{"a": 1, "b": [2, 9] }', '{"b": {"e": 7, "f": 8}, "d": 4 }' );
json_merge( '{"a": 1, "b": [2, 9] }', '{"b": {"e": 7, "f": 8}, "d": 4 }' )
-{"a": 1, "b": [2, 9], "b": {"e": 7, "f": 8}, "d": 4}
+{"a": 1, "b": [2, 9, {"e": 7, "f": 8}], "d": 4}
select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": [2, 9] }' );
json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": [2, 9] }' )
-{"b": {"e": 7, "f": 8}, "d": 4, "a": 1, "b": [2, 9]}
+{"b": [{"e": 7, "f": 8}, 2, 9], "d": 4, "a": 1}
select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{ "a": 1, "b": {"e": 20, "g": 21 } }' );
json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{ "a": 1, "b": {"e": 20, "g": 21 } }' )
-{"b": {"e": 7, "f": 8}, "d": 4, "a": 1, "b": {"e": 20, "g": 21}}
+{"b": {"e": [7, 20], "f": 8, "g": 21}, "d": 4, "a": 1}
select json_merge( '1', '2', '3' );
json_merge( '1', '2', '3' )
[1, 2, 3]
@@ -898,7 +898,7 @@ json_merge
'{ "d": false, "b": { "g": 3, "d": 5 }, "f": [ 1, 2 ] }',
'{ "m": true, "b": { "h": 8, "d": 4 }, "e": [ 3, 4 ] }'
)
-{"a": true, "b": {"c": 3, "d": 4}, "e": [1, 2], "d": false, "b": {"g": 3, "d": 5}, "f": [1, 2], "m": true, "b": {"h": 8, "d": 4}, "e": [3, 4]}
+{"a": true, "b": {"c": 3, "d": [4, 5, 4], "g": 3, "h": 8}, "e": [1, 2, 3, 4], "d": false, "f": [1, 2], "m": true}
SELECT JSON_MERGE
(
'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
@@ -920,7 +920,7 @@ JSON_MERGE
'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
'{ "b": [ false, 34 ] }'
)
-{"a": "foo", "b": [true, {"c": 123}], "b": [false, 34]}
+{"a": "foo", "b": [true, {"c": 123}, false, 34]}
SELECT JSON_MERGE
(
'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
@@ -931,7 +931,7 @@ JSON_MERGE
'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
'{ "b": "bar" }'
)
-{"a": "foo", "b": [true, {"c": 123}], "b": "bar"}
+{"a": "foo", "b": [true, {"c": 123}, "bar"]}
SELECT JSON_MERGE
(
'{ "a" : { "b" : 1 } }',
@@ -942,7 +942,7 @@ JSON_MERGE
'{ "a" : { "b" : 1 } }',
'{ "a" : { "c" : 1 } }'
)
-{"a": {"b": 1}, "a": {"c": 1}}
+{"a": {"b": 1, "c": 1}}
# ----------------------------------------------------------------------
# Test of JSON_TYPE function.
# ----------------------------------------------------------------------