2016-10-19 12:10:03 +02:00
|
|
|
select json_valid('[1, 2]');
|
|
|
|
select json_valid('"string"}');
|
|
|
|
select json_valid('{"key1":1, "key2":[2,3]}');
|
|
|
|
select json_valid('[false, true, null]');
|
2016-12-03 09:36:10 +01:00
|
|
|
select json_valid(repeat('[', 1000));
|
2016-12-03 09:41:19 +01:00
|
|
|
select json_valid(repeat('{"a":', 1000));
|
2016-10-19 12:10:03 +02:00
|
|
|
|
|
|
|
select json_value('{"key1":123}', '$.key2');
|
|
|
|
select json_value('{"key1":123}', '$.key1');
|
|
|
|
select json_value('{"key1":[1,2,3]}', '$.key1');
|
|
|
|
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
|
|
|
|
|
|
|
|
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
|
|
|
|
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');
|
|
|
|
select json_query('{"key1": 1}', '$.key1');
|
|
|
|
select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
|
2016-12-09 09:26:32 +01:00
|
|
|
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)));
|
2016-10-19 12:10:03 +02:00
|
|
|
|
2016-12-03 08:45:24 +01:00
|
|
|
select json_array();
|
2016-10-19 12:10:03 +02:00
|
|
|
select json_array(1);
|
|
|
|
select json_array(1, "text", false, null);
|
|
|
|
|
|
|
|
select json_array_append('["a", "b"]', '$', FALSE);
|
|
|
|
select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2);
|
2016-12-05 05:43:15 +01:00
|
|
|
select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2);
|
2016-10-19 12:10:03 +02:00
|
|
|
|
2016-12-05 05:03:11 +01:00
|
|
|
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x');
|
|
|
|
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x');
|
|
|
|
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x');
|
|
|
|
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
|
|
|
|
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x');
|
2016-12-05 05:52:37 +01:00
|
|
|
select json_array_insert('true', '$', 1);
|
2016-12-16 10:51:35 +01:00
|
|
|
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y');
|
2016-11-15 14:04:31 +01:00
|
|
|
|
2016-10-19 12:10:03 +02:00
|
|
|
select json_contains('{"k1":123, "k2":345}', '123', '$.k1');
|
|
|
|
select json_contains('"you"', '"you"');
|
|
|
|
select json_contains('"youth"', '"you"');
|
2016-12-04 21:15:08 +01:00
|
|
|
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select json_contains('[1]', '[1]', '$', '$[0]');
|
2016-12-10 22:12:33 +01:00
|
|
|
select json_contains('', '', '$');
|
|
|
|
select json_contains('null', 'null', '$');
|
|
|
|
select json_contains('"10"', '"10"', '$');
|
|
|
|
select json_contains('"10"', '10', '$');
|
|
|
|
select json_contains('10.1', '10', '$');
|
|
|
|
select json_contains('10.0', '10', '$');
|
|
|
|
select json_contains('[1]', '1');
|
|
|
|
select json_contains('[2, 1]', '1');
|
|
|
|
select json_contains('[2, [2, 3], 1]', '1');
|
|
|
|
select json_contains('[4, [2, 3], 1]', '2');
|
|
|
|
select json_contains('[2, 1]', '[1, 2]');
|
|
|
|
select json_contains('[2, 1]', '[1, 0, 2]');
|
|
|
|
select json_contains('[2, 0, 3, 1]', '[1, 2]');
|
|
|
|
select json_contains('{"b":[1,2], "a":1}', '{"a":1, "b":2}');
|
|
|
|
select json_contains('{"a":1}', '{}');
|
|
|
|
select json_contains('[1, {"a":1}]', '{}');
|
|
|
|
select json_contains('[1, {"a":1}]', '{"a":1}');
|
2016-12-16 09:32:56 +01:00
|
|
|
select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
|
|
|
|
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
|
2016-10-19 12:10:03 +02:00
|
|
|
|
|
|
|
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
|
|
|
|
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
|
|
|
|
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma");
|
|
|
|
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1");
|
|
|
|
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
|
|
|
|
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
|
|
|
|
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
|
2016-12-03 08:02:28 +01:00
|
|
|
select json_contains_path('{ "a": true }', NULL, '$.a' );
|
2016-12-03 08:22:42 +01:00
|
|
|
select json_contains_path('{ "a": true }', 'all', NULL );
|
2016-12-16 09:43:44 +01:00
|
|
|
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
|
2016-10-19 12:10:03 +02:00
|
|
|
|
|
|
|
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
|
|
|
|
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
|
|
|
|
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2");
|
|
|
|
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2");
|
|
|
|
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1");
|
2016-12-03 07:53:12 +01:00
|
|
|
select json_extract(json_object('foo', 'foobar'),'$');
|
2016-12-05 06:34:28 +01:00
|
|
|
select json_extract('[10, 20, [30, 40]]', '$[2][*]');
|
|
|
|
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
|
2016-12-08 08:25:21 +01:00
|
|
|
select json_extract('1', '$');
|
2016-12-24 07:51:43 +01:00
|
|
|
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
|
2017-01-24 14:34:44 +01:00
|
|
|
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
|
|
|
|
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
|
2016-10-19 12:10:03 +02:00
|
|
|
|
2016-11-15 14:04:31 +01:00
|
|
|
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
|
|
|
|
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
|
|
|
|
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2);
|
|
|
|
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word');
|
|
|
|
|
|
|
|
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
|
|
|
|
|
|
|
|
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
|
|
|
|
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]');
|
|
|
|
|
|
|
|
set @j = '["a", ["b", "c"], "d"]';
|
|
|
|
select json_remove(@j, '$[0]');
|
|
|
|
select json_remove(@j, '$[1]');
|
|
|
|
select json_remove(@j, '$[2]');
|
|
|
|
set @j = '{"a": 1, "b": [2, 3]}';
|
|
|
|
select json_remove(@j, '$.b');
|
|
|
|
select json_remove(@j, '$.a');
|
|
|
|
|
2016-12-03 08:45:24 +01:00
|
|
|
select json_object();
|
2016-10-19 12:10:03 +02:00
|
|
|
select json_object("ki", 1, "mi", "ya");
|
2016-12-04 11:22:01 +01:00
|
|
|
create table t1 as select json_object('id', 87, 'name', 'carrot') as f;
|
|
|
|
show create table t1;
|
|
|
|
select * from t1;
|
|
|
|
drop table t1;
|
2016-10-19 12:10:03 +02:00
|
|
|
|
|
|
|
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
|
|
|
|
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");
|
|
|
|
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");
|
|
|
|
|
|
|
|
select json_quote('"string"');
|
2016-12-04 11:49:06 +01:00
|
|
|
create table t1 as select json_quote('foo');
|
|
|
|
select * from t1;
|
|
|
|
show create table t1;
|
|
|
|
drop table t1;
|
2016-10-19 12:10:03 +02:00
|
|
|
|
2016-12-04 20:57:26 +01:00
|
|
|
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select json_merge('string');
|
2016-10-19 12:10:03 +02:00
|
|
|
select json_merge('string', 123);
|
2016-12-05 22:32:13 +01:00
|
|
|
select json_merge('"string"', 123);
|
|
|
|
select json_merge('[1, 2]', '[true, false]');
|
|
|
|
select json_merge('{"1": 2}', '{"true": false}');
|
|
|
|
select json_merge('{"1": 2}', '{"true": false}', '{"3": 4}');
|
|
|
|
select json_merge(NULL,json_object('foo', 1));
|
2016-12-05 22:35:40 +01:00
|
|
|
select json_merge('a','b');
|
2016-12-05 22:39:06 +01:00
|
|
|
select json_merge('{"a":"b"}','{"c":"d"}');
|
2016-12-20 14:32:08 +01:00
|
|
|
SELECT JSON_MERGE('[1, 2]', '{"id": 47}');
|
2016-10-19 12:10:03 +02:00
|
|
|
|
|
|
|
select json_type('{"k1":123, "k2":345}');
|
|
|
|
select json_type('[123, "k2", 345]');
|
|
|
|
select json_type("true");
|
|
|
|
select json_type('123');
|
2016-12-04 22:01:09 +01:00
|
|
|
select json_type('123.12');
|
2016-10-19 12:10:03 +02:00
|
|
|
|
2016-11-15 14:04:31 +01:00
|
|
|
select json_keys('{"a":{"c":1, "d":2}, "b":2}');
|
|
|
|
select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a");
|
|
|
|
select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b");
|
2016-12-13 09:39:48 +01:00
|
|
|
select json_keys('foo');
|
2017-08-08 13:40:11 +02:00
|
|
|
#
|
|
|
|
# mdev-12789 JSON_KEYS returns duplicate keys twice
|
|
|
|
#
|
|
|
|
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}');
|
|
|
|
select json_keys('{"c1": "value 1", "c1": "value 2"}');
|
2016-11-15 14:04:31 +01:00
|
|
|
|
|
|
|
SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
|
|
|
|
select json_search(@j, 'one', 'abc');
|
|
|
|
select json_search(@j, 'all', 'abc');
|
|
|
|
select json_search(@j, 'all', 'abc', NULL, '$[2]');
|
|
|
|
select json_search(@j, 'all', 'abc', NULL, '$');
|
|
|
|
select json_search(@j, 'all', '10', NULL, '$');
|
|
|
|
select json_search(@j, 'all', '10', NULL, '$[*]');
|
|
|
|
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
|
2016-12-09 09:26:32 +01:00
|
|
|
select json_search(@j, 'all', '10', NULL, '$**.k');
|
2016-12-03 09:11:06 +01:00
|
|
|
create table t1( json_col text );
|
|
|
|
insert into t1 values
|
|
|
|
('{ "a": "foobar" }'),
|
|
|
|
('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
|
|
|
|
select json_search( json_col, 'all', 'foot' ) from t1;
|
|
|
|
drop table t1;
|
2016-11-15 14:04:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
select json_unquote('"abc"');
|
2016-12-05 21:34:25 +01:00
|
|
|
select json_unquote('abc');
|
2016-11-15 14:04:31 +01:00
|
|
|
|
|
|
|
select json_object("a", json_object("b", "abcd"));
|
|
|
|
select json_object("a", '{"b": "abcd"}');
|
2017-02-14 11:11:47 +01:00
|
|
|
select json_object("a", json_compact('{"b": "abcd"}'));
|
2016-11-15 14:04:31 +01:00
|
|
|
|
2017-02-14 11:11:47 +01:00
|
|
|
select json_compact(NULL);
|
|
|
|
select json_depth(json_compact(NULL));
|
2016-12-05 04:17:54 +01:00
|
|
|
select json_depth('[[], {}]');
|
|
|
|
select json_depth('[[[1,2,3],"s"], {}, []]');
|
2016-12-16 11:06:12 +01:00
|
|
|
select json_depth('[10, {"a": 20}]');
|
2016-12-03 08:32:47 +01:00
|
|
|
|
2016-12-05 05:59:55 +01:00
|
|
|
select json_length('');
|
|
|
|
select json_length('{}');
|
|
|
|
select json_length('[1, 2, {"a": 3}]');
|
2016-12-24 08:40:31 +01:00
|
|
|
select json_length('{"a": 1, "b": {"c": 30}}', '$.b');
|
|
|
|
select json_length('{"a": 1, "b": {"c": 30}}');
|
2016-12-05 21:39:53 +01:00
|
|
|
|
|
|
|
create table json (j INT);
|
|
|
|
show create table json;
|
|
|
|
drop table json;
|
|
|
|
|
2017-01-26 13:35:05 +01:00
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
|
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
|
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
|
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
|
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
|
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
|
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
|
|
|
|
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
|
|
|
|
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
|
|
|
|
|
|
|
|
select json_set('1', '$[0]', 100);
|
|
|
|
select json_set('1', '$[0][0]', 100);
|
|
|
|
select json_set('1', '$[1]', 100);
|
|
|
|
select json_set('{"a":12}', '$[0]', 100);
|
|
|
|
select json_set('{"a":12}', '$[0].a', 100);
|
|
|
|
select json_set('{"a":12}', '$[0][0].a', 100);
|
|
|
|
select json_set('{"a":12}', '$[0][1].a', 100);
|
|
|
|
|
2017-02-02 15:56:15 +01:00
|
|
|
select json_value('{"\\"key1":123}', '$."\\"key1"');
|
|
|
|
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""');
|
|
|
|
select json_value('{"key 1":123}', '$."key 1"');
|
2017-02-06 03:47:48 +01:00
|
|
|
|
|
|
|
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]");
|
|
|
|
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]");
|
|
|
|
|
|
|
|
select json_extract( '[1]', '$[0][0]' );
|
|
|
|
select json_extract( '[1]', '$[1][0]' );
|
|
|
|
select json_extract( '[1]', '$**[0]' );
|
|
|
|
select json_extract( '[1]', '$**[0][0]' );
|
|
|
|
|
|
|
|
select json_insert('1', '$[0]', 4);
|
|
|
|
select json_replace('1', '$[0]', 4);
|
|
|
|
select json_set('1', '$[0]', 4);
|
|
|
|
select json_set('1', '$[1]', 4);
|
|
|
|
select json_replace('1', '$[1]', 4);
|
|
|
|
SELECT json_insert('[]', '$[0][0]', 100);
|
|
|
|
SELECT json_insert('1', '$[0][0]', 100);
|
|
|
|
SELECT json_replace('1', '$[0][0]', 100);
|
|
|
|
SELECT json_replace('[]', '$[0][0]', 100);
|
|
|
|
SELECT json_set('[]', '$[0][0]', 100);
|
|
|
|
SELECT json_set('[]', '$[0][0][0]', 100);
|
2017-02-09 14:38:53 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# MDEV-11857 json_search() shows "Out of memory" with empty key.
|
|
|
|
#
|
|
|
|
SELECT JSON_search( '{"": "a"}', "one", 'a');
|
2017-02-09 22:05:27 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# MDEV-11858 json_merge() concatenates instead of merging.
|
|
|
|
#
|
|
|
|
|
|
|
|
select json_merge('{"a":"b"}', '{"a":"c"}') ;
|
|
|
|
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') ;
|
|
|
|
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') ;
|
|
|
|
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
|
2017-02-14 14:51:03 +01:00
|
|
|
|
|
|
|
select json_compact('{"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"}}');
|
|
|
|
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
|
2017-03-14 12:25:02 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# MDEV-11856 json_search doesn't search for values with double quotes character (")
|
|
|
|
#
|
|
|
|
|
|
|
|
SELECT JSON_search( '{"x": "\\""}', "one", '"');
|
|
|
|
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
|
2017-03-14 14:31:14 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# MDEV-11833 JSON functions don't seem to respect max_allowed_packet.
|
|
|
|
#
|
|
|
|
set @@global.net_buffer_length=1024;
|
|
|
|
set @@global.max_allowed_packet=2048;
|
|
|
|
--connect (newconn, localhost, root,,)
|
|
|
|
|
|
|
|
show variables like 'net_buffer_length';
|
|
|
|
show variables like 'max_allowed_packet';
|
|
|
|
select json_array(repeat('a',1024),repeat('a',1024));
|
|
|
|
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
|
|
|
|
--connection default
|
|
|
|
|
|
|
|
set @@global.max_allowed_packet = default;
|
|
|
|
set @@global.net_buffer_length = default;
|
|
|
|
--disconnect newconn
|
|
|
|
|
2017-03-20 12:18:06 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on JSON_REMOVE.
|
|
|
|
#
|
|
|
|
create table t1(j longtext, p longtext);
|
|
|
|
insert into t1 values
|
|
|
|
('{"a":1,"b":2,"c":3}','$.a'),
|
|
|
|
('{"a":1,"b":2,"c":3}','$.b'),
|
|
|
|
('{"a":1,"b":2,"c":3}','$.c');
|
|
|
|
select j, p, json_remove(j, p) from t1;
|
|
|
|
drop table t1;
|
2017-05-02 12:28:57 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# MDEV-12364 Server crashes in __memcpy_sse2_unaligned / String::copy on JSON_SEARCH with variables.
|
|
|
|
#
|
|
|
|
SET @str = 'bar', @path = '$';
|
|
|
|
SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
|
|
|
|
|
2017-05-02 13:16:01 +02:00
|
|
|
#
|
|
|
|
# MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path.
|
|
|
|
#
|
|
|
|
|
|
|
|
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
|
|
|
|
|
2017-05-02 13:47:43 +02:00
|
|
|
#
|
|
|
|
# MDEV-12363 Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE t1 (f INT NOT NULL);
|
|
|
|
INSERT INTO t1 VALUES (0);
|
|
|
|
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2017-08-07 11:46:45 +02:00
|
|
|
#
|
|
|
|
# MDEV-12324 Wrong result (phantom array value) on JSON_EXTRACT.
|
|
|
|
#
|
|
|
|
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
|
|
|
|
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
|
|
|
|
|
2017-08-08 08:35:26 +02:00
|
|
|
#
|
|
|
|
# MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.
|
|
|
|
#
|
|
|
|
|
|
|
|
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
|
|
|
|
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true;
|
|
|
|
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
|
|
|
|
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1;
|
|
|
|
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
|
|
|
|
|
2017-09-12 09:20:30 +02:00
|
|
|
#
|
|
|
|
# MDEV-129892 JSON_EXTRACT returns data for invalid JSON
|
|
|
|
#
|
|
|
|
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
|
|
|
|
|
2017-09-12 11:26:03 +02:00
|
|
|
#
|
|
|
|
# MDEV-13138 JSON_OBJECT returns null with strings containing backticks.
|
|
|
|
#
|
|
|
|
SELECT JSON_OBJECT('foo', '`');
|
|
|
|
SELECT JSON_OBJECT("foo", "bar`bar");
|
|
|
|
|
2017-09-12 12:40:18 +02:00
|
|
|
#
|
|
|
|
# MDEV-13324 JSON_SET returns NULL instead of object.
|
|
|
|
#
|
|
|
|
SELECT JSON_SET('{}', '$.age', 87);
|
|
|
|
|