[MDEV-24538] JSON_LENGTH does not return error upon wrong number of parameters Created: 2021-01-06  Updated: 2023-02-14  Resolved: 2023-02-14

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.11.3, 11.0.1, 10.4.29, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: None


 Description   

JSON_LENGTH documented (both for MariaDB and MySQL) as taking one mandatory and one optional parameter:

JSON_LENGTH(json_doc[, path])

However, in MariaDB it accepts extra parameters without complaining:

10.5 1b12e251

MariaDB [test]> SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo');
+-----------------------------------------+
| JSON_LENGTH('{"a":"b"}','$','$', 'foo') |
+-----------------------------------------+
|                                       1 |
+-----------------------------------------+
1 row in set (0.000 sec)

MySQL returns an error:

MySQL [test]> SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo');
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'JSON_LENGTH'



 Comments   
Comment by Daniel Black [ 2023-02-14 ]

Thanks Weijun

Generated at Thu Feb 08 09:30:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.