Bug #72196 json_append: error message not entirely correct
Submitted: 1 Apr 2014 19:04 Modified: 2 Apr 2014 19:30
Reporter: Roland Bouman Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: JSON User-defined function ( UDF ) Severity:S3 (Non-critical)
Version:0.3.1 OS:Any
Assigned to:
Triage: Needs Triage: D3 (Medium)

[1 Apr 2014 19:04] Roland Bouman
When the json_append function is not given enough arguments, the message is:

mysql> select json_append(@json);
ERROR 1123 (HY000): Can't initialize function 'json_append'; You must supply at least 3 string arguments

This message is not entirely correct. Path arguments (so any argument between the first and the last argument) can be strings or integers. For instance:

mysql> select json_append('[{},{}]', 2, '{}');
| json_append('[{},{}]', 2, '{}') |
| [{},{}, {}]                     |
1 row in set (0.00 sec)

Works as expected, and the second argument is not a string argument (nor should it be)

How to repeat:
See description

Suggested fix:
Please modify the message so as to reflect that path arguments can be either strings or integers.
[1 Apr 2014 19:29] Sveta Smirnova
Thank you for the report.

Verified as described.
[2 Apr 2014 19:30] Sveta Smirnova
Posted by developer:
Fixed in version 0.3.2.

Now it will print error messages as below:

select json_append();
ERROR HY000: Can't initialize function 'json_append'; You must supply at least 3 arguments
select json_append(1, 1.1, 1);
ERROR HY000: Can't initialize function 'json_append'; JSON_APPEND accepts only string and integer arguments