summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2022-03-05 01:03:49 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2022-04-15 01:02:44 +0530
commitc781cefd8afc0fa5840456c96f5a0c37cac2edfa (patch)
treedb5008c4f763e4d954f7f9fefa0270f6bc3effbd /mysql-test
parentabe971219456b1f41923c06ff715fd4efeb02850 (diff)
downloadmariadb-git-c781cefd8afc0fa5840456c96f5a0c37cac2edfa.tar.gz
MDEV-27911: Implement range notation for json path
Range can be thought about in similar manner as wildcard (*) where more than one elements are processed. To implement range notation, extended json parser to parse the 'to' keyword and added JSON_PATH_ARRAY_RANGE for path type. If there is 'to' keyword then use JSON_PATH_ARRAY range for path type along with existing type. This new integer to store the end index of range is n_item_end. When there is 'to' keyword, store the integer in n_item_end else store in n_item.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/func_json.result189
-rw-r--r--mysql-test/main/func_json.test161
-rw-r--r--mysql-test/suite/json/r/json_no_table.result56
3 files changed, 378 insertions, 28 deletions
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index 18a700607ab..1707c59bf19 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -2029,5 +2029,194 @@ SELECT JSON_VALUE(@json,'$.x[0]');
JSON_VALUE(@json,'$.x[0]')
0
#
+# MDEV-27911: Implement range notation for json path
+#
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXISTS(@json, '$[3][3][-2 to last]');
+JSON_EXISTS(@json, '$[3][3][-2 to last]')
+1
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_SEARCH(@json, 'one', '12', NULL, '$[3][0 to 3]');
+JSON_SEARCH(@json, 'one', '12', NULL, '$[3][0 to 3]')
+NULL
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_VALUE(@json, '$[0][1 to 2].key1');
+JSON_VALUE(@json, '$[0][1 to 2].key1')
+value1
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_QUERY(@json, '$.A[-2][-3 to -1]');
+JSON_QUERY(@json, '$.A[-2][-3 to -1]')
+[13, 14]
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXTRACT(@json, '$[0 to 3][2]');
+JSON_EXTRACT(@json, '$[0 to 3][2]')
+[3, 6, [9, {"key2": 2}, 11], [14]]
+SELECT JSON_EXTRACT(@json, '$[3][3][last-1 to last]');
+JSON_EXTRACT(@json, '$[3][3][last-1 to last]')
+["string1", [16, {"key1": [1, 2, 3, [4, 5, 6]]}, 18]]
+SELECT JSON_EXTRACT(@json, '$[3][3][-2 to -1]');
+JSON_EXTRACT(@json, '$[3][3][-2 to -1]')
+["string1", [16, {"key1": [1, 2, 3, [4, 5, 6]]}, 18]]
+# Checking errors
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS_PATH(@json,'one', '$[3][0 to 3]');
+JSON_CONTAINS_PATH(@json,'one', '$[3][0 to 3]')
+1
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS(@json, '$[3][0 to 3]');
+JSON_CONTAINS(@json, '$[3][0 to 3]')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 2 to function 'json_contains' at position 1
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_INSERT(@json, '$.A[0 to last-1]', 5);
+JSON_ARRAY_INSERT(@json, '$.A[0 to last-1]', 5)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_insert'
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_APPEND(@json, '$.A[*]', 7);
+JSON_ARRAY_APPEND(@json, '$.A[*]', 7)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_SET(@json, '$[0][1 to 2].key1', 1);
+JSON_SET(@json, '$[0][1 to 2].key1', 1)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_set'
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REPLACE(@json, '$[1][last-2 to last]', 4);
+JSON_REPLACE(@json, '$[1][last-2 to last]', 4)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_replace'
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REMOVE(@json, '$[1][-6 to last-2]');
+JSON_REMOVE(@json, '$[1][-6 to last-2]')
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_KEYS(@json, '$.A[8][1 to 3]');
+JSON_KEYS(@json, '$.A[8][1 to 3]')
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_keys'
+#
# End of 10.9 Test
#
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 34a4b30b0ab..2a06313e5c7 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -1316,6 +1316,167 @@ SELECT JSON_VALUE(@json,'$.x[last-0]');
SELECT JSON_VALUE(@json,'$.x[-0]');
SELECT JSON_VALUE(@json,'$.x[0]');
+
+--echo #
+--echo # MDEV-27911: Implement range notation for json path
+--echo #
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXISTS(@json, '$[3][3][-2 to last]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_SEARCH(@json, 'one', '12', NULL, '$[3][0 to 3]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_VALUE(@json, '$[0][1 to 2].key1');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_QUERY(@json, '$.A[-2][-3 to -1]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXTRACT(@json, '$[0 to 3][2]');
+SELECT JSON_EXTRACT(@json, '$[3][3][last-1 to last]');
+SELECT JSON_EXTRACT(@json, '$[3][3][-2 to -1]');
+
+--echo # Checking errors
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS_PATH(@json,'one', '$[3][0 to 3]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS(@json, '$[3][0 to 3]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_INSERT(@json, '$.A[0 to last-1]', 5);
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_APPEND(@json, '$.A[*]', 7);
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_SET(@json, '$[0][1 to 2].key1', 1);
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REPLACE(@json, '$[1][last-2 to last]', 4);
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REMOVE(@json, '$[1][-6 to last-2]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_KEYS(@json, '$.A[8][1 to 3]');
+
--echo #
--echo # End of 10.9 Test
--echo #
diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result
index 6784fe6da32..e9af1fc68c8 100644
--- a/mysql-test/suite/json/r/json_no_table.result
+++ b/mysql-test/suite/json/r/json_no_table.result
@@ -402,7 +402,7 @@ select json_length( 'true', '$.*' );
json_length( 'true', '$.*' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_length'
# wildcards not allowed in path expressions for this function
error ER_INVALID_JSON_PATH_WILDCARD
@@ -410,7 +410,7 @@ select json_length( 'true', '$.foo**.bar' );
json_length( 'true', '$.foo**.bar' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_length'
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' )
1
@@ -691,25 +691,25 @@ select json_remove( '[ 1, 2, 3 ]', '$[*]' );
json_remove( '[ 1, 2, 3 ]', '$[*]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
error ER_INVALID_JSON_PATH_WILDCARD
select json_remove( '[ 1, 2, 3 ]', '$**[2]' );
json_remove( '[ 1, 2, 3 ]', '$**[2]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
error ER_INVALID_JSON_PATH_WILDCARD
select json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' );
json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 3 to function 'json_remove'
error ER_INVALID_JSON_PATH_WILDCARD
select json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' );
json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 3 to function 'json_remove'
select json_remove( '[ 1, 2, 3 ]', '$[0]' );
json_remove( '[ 1, 2, 3 ]', '$[0]' )
[2, 3]
@@ -730,7 +730,7 @@ select json_remove( '[ { "a": { "a": true } } ]', '$**.a' );
json_remove( '[ { "a": { "a": true } } ]', '$**.a' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
select json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' );
json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' )
[{}, {"b": false}, {}, {"a": null}]
@@ -739,7 +739,7 @@ select json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c
json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c": null }, { "a": null } ]', '$**.a' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
select json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' );
json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' )
{"id": 123, "name": "systemQA", "array": [1, 2, 3]}
@@ -1210,7 +1210,7 @@ select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b');
json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b')
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_keys'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_keys'
# returns [ "a", "b" ]
SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }');
JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }')
@@ -1637,7 +1637,7 @@ select json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6);
json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
# Auto-wrapping, since because the paths identify scalars.
# should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]}
SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}',
@@ -1668,13 +1668,13 @@ select json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4);
json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
error ER_INVALID_JSON_PATH_WILDCARD
select json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4);
json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
SELECT JSON_ARRAY_APPEND
(
'{ "a" : "foo", "b" : "bar", "c" : "wibble" }',
@@ -1775,73 +1775,73 @@ select json_insert(json_compact('{"a": [1], "b": 2}'), '$.*[1]', 6);
json_insert(json_compact('{"a": [1], "b": 2}'), '$.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": 1, "b": 2}'), '$.*[1]', 6);
json_insert(json_compact('{"a": 1, "b": 2}'), '$.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": 3}}'), '$.a.*[1]', 6);
json_insert(json_compact('{"a": {"b": 3}}'), '$.a.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": [3]}}'), '$.a.*[1]', 6);
json_insert(json_compact('{"a": {"b": [3]}}'), '$.a.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": 3}}'), '$**[1]', 6);
json_insert(json_compact('{"a": {"b": 3}}'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6);
json_insert(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1]'), '$[*][1]', 6);
json_insert(json_compact('[1]'), '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1]'), '$**[1]', 6);
json_insert(json_compact('[1]'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1, [2], 3]'), '$[*][1]', 6);
json_insert(json_compact('[1, [2], 3]'), '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1, [2], 3]'), '$**[1]', 6);
json_insert(json_compact('[1, [2], 3]'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[[1]]'), '$[*][1]', 6);
json_insert(json_compact('[[1]]'), '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[[1]]'), '$**[1]', 6);
json_insert(json_compact('[[1]]'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
select json_insert(json_compact('{"a": 3}'), '$[1]', 6);
json_insert(json_compact('{"a": 3}'), '$[1]', 6)
[{"a": 3}, 6]
@@ -2053,19 +2053,19 @@ select json_insert('[]', '$.a.*[1]', 6);
json_insert('[]', '$.a.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert('[]', '$**[1]', 6);
json_insert('[]', '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert('[]', '$[*][1]', 6);
json_insert('[]', '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false );
json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false )
[1, false, true, 2, 3]
@@ -2154,7 +2154,7 @@ select json_set(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6);
json_set(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_set'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_set'
SELECT JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
'$.a',
JSON_OBJECT());