Commit c89c514e authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-11445 JSON_MERGE requires at least two arguments in MySQL, but not in MariaDB.

        Create_func_json_merge::create_native fixed.
parent 12897a5b
......@@ -197,6 +197,8 @@ t1 CREATE TABLE `t1` (
`json_quote('foo')` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select json_merge('string');
ERROR 42000: Incorrect parameter count in the call to native function 'json_merge'
select json_merge('string', 123);
json_merge('string', 123)
["string", 123]
......
......@@ -83,6 +83,8 @@ select * from t1;
show create table t1;
drop table t1;
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select json_merge('string');
select json_merge('string', 123);
select json_type('{"k1":123, "k2":345}');
......
......@@ -5192,7 +5192,7 @@ Create_func_json_merge::create_native(THD *thd, LEX_STRING name,
int arg_count;
if (item_list == NULL ||
(arg_count= item_list->elements) == 0)
(arg_count= item_list->elements) < 2) // json, json
{
my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
func= NULL;
......
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