Commit 39cafb66 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge branch '10.6' into bb-10.6-release

parents b8f6d315 dacd4249
MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=6 MYSQL_VERSION_MINOR=6
MYSQL_VERSION_PATCH=9 MYSQL_VERSION_PATCH=10
SERVER_MATURITY=stable SERVER_MATURITY=stable
...@@ -822,7 +822,7 @@ CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1; ...@@ -822,7 +822,7 @@ CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(25) DEFAULT NULL `JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2; DROP TABLE t1, t2;
SET sql_mode=default; SET sql_mode=default;
...@@ -1437,5 +1437,20 @@ f ...@@ -1437,5 +1437,20 @@ f
DROP VIEW v; DROP VIEW v;
DROP TABLE t; DROP TABLE t;
# #
# MDEV-29264 JSON functions overflow error based ON LONGTEXT field
#
CREATE TABLE t(l1 LONGTEXT, l2 LONGTEXT, l3 LONGTEXT, l4 LONGTEXT);
INSERT INTO t VALUES('k1', 'v1', 'k2', 'v2');
SELECT JSON_ARRAY(l1, l2, l3, l4), JSON_OBJECT(l1, l2, l3, l4) from t;
JSON_ARRAY(l1, l2, l3, l4) JSON_OBJECT(l1, l2, l3, l4)
["k1", "v1", "k2", "v2"] {"k1": "v1", "k2": "v2"}
SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') from t;
JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3')
[["k1", "k3"], "v1", "k2", "v2"] ["k3", "k1", "v1", "k2", "v2"]
SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t;
JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3') JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2')
{"k1": "v1", "k2": "v2", "k3": "v3"} {"k1": "v1", "k2": "new v2"} {"k1": "v1", "k2": "new v2"}
DROP TABLE t;
#
# End of 10.5 tests # End of 10.5 tests
# #
...@@ -927,6 +927,17 @@ SELECT JSON_ARRAYAGG(a) AS f FROM v; ...@@ -927,6 +927,17 @@ SELECT JSON_ARRAYAGG(a) AS f FROM v;
DROP VIEW v; DROP VIEW v;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-29264 JSON functions overflow error based ON LONGTEXT field
--echo #
CREATE TABLE t(l1 LONGTEXT, l2 LONGTEXT, l3 LONGTEXT, l4 LONGTEXT);
INSERT INTO t VALUES('k1', 'v1', 'k2', 'v2');
SELECT JSON_ARRAY(l1, l2, l3, l4), JSON_OBJECT(l1, l2, l3, l4) from t;
SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') from t;
SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t;
DROP TABLE t;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
......
...@@ -1738,7 +1738,7 @@ bool Item_func_json_array::fix_length_and_dec() ...@@ -1738,7 +1738,7 @@ bool Item_func_json_array::fix_length_and_dec()
return TRUE; return TRUE;
for (n_arg=0 ; n_arg < arg_count ; n_arg++) for (n_arg=0 ; n_arg < arg_count ; n_arg++)
char_length+= args[n_arg]->max_char_length() + 4; char_length+= static_cast<ulonglong>(args[n_arg]->max_char_length()) + 4;
fix_char_length_ulonglong(char_length); fix_char_length_ulonglong(char_length);
tmp_val.set_charset(collation.collation); tmp_val.set_charset(collation.collation);
...@@ -1797,7 +1797,8 @@ bool Item_func_json_array_append::fix_length_and_dec() ...@@ -1797,7 +1797,8 @@ bool Item_func_json_array_append::fix_length_and_dec()
for (n_arg= 1; n_arg < arg_count; n_arg+= 2) for (n_arg= 1; n_arg < arg_count; n_arg+= 2)
{ {
paths[n_arg/2].set_constant_flag(args[n_arg]->const_item()); paths[n_arg/2].set_constant_flag(args[n_arg]->const_item());
char_length+= args[n_arg/2+1]->max_char_length() + 4; char_length+=
static_cast<ulonglong>(args[n_arg+1]->max_char_length()) + 4;
} }
fix_char_length_ulonglong(char_length); fix_char_length_ulonglong(char_length);
...@@ -2957,7 +2958,8 @@ bool Item_func_json_insert::fix_length_and_dec() ...@@ -2957,7 +2958,8 @@ bool Item_func_json_insert::fix_length_and_dec()
for (n_arg= 1; n_arg < arg_count; n_arg+= 2) for (n_arg= 1; n_arg < arg_count; n_arg+= 2)
{ {
paths[n_arg/2].set_constant_flag(args[n_arg]->const_item()); paths[n_arg/2].set_constant_flag(args[n_arg]->const_item());
char_length+= args[n_arg/2+1]->max_char_length() + 4; char_length+=
static_cast<ulonglong>(args[n_arg+1]->max_char_length()) + 4;
} }
fix_char_length_ulonglong(char_length); fix_char_length_ulonglong(char_length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment