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:
None 
Category:MySQL Server: JSON User-defined function ( UDF ) Severity:S3 (Non-critical)
Version:0.3.1 OS:Any
Assigned to: CPU Architecture:Any

[1 Apr 2014 19:04] Roland Bouman
Description:
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

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.