Browse Source

MDEV-11468 JSON_UNQUOTE returns incorrect results.

Now return the argument's value when error.
pull/274/head
Alexey Botchkov 9 years ago
parent
commit
3743b4c3ef
  1. 3
      mysql-test/r/func_json.result
  2. 1
      mysql-test/t/func_json.test
  3. 4
      sql/item_jsonfunc.cc

3
mysql-test/r/func_json.result

@ -277,6 +277,9 @@ drop table t1;
select json_unquote('"abc"');
json_unquote('"abc"')
abc
select json_unquote('abc');
json_unquote('abc')
abc
select json_object("a", json_object("b", "abcd"));
json_object("a", json_object("b", "abcd"))
{"a": {"b": "abcd"}}

1
mysql-test/t/func_json.test

@ -121,6 +121,7 @@ drop table t1;
select json_unquote('"abc"');
select json_unquote('abc');
select json_object("a", json_object("b", "abcd"));
select json_object("a", '{"b": "abcd"}');

4
sql/item_jsonfunc.cc

@ -359,8 +359,8 @@ String *Item_func_json_unquote::val_str(String *str)
return str;
error:
null_value= 1;
return 0;
/* We just return the argument's value in the case of error. */
return js;
}

Loading…
Cancel
Save