[MDEV-11446] JSON_MERGE accepts arguments in invalid format Created: 2016-12-01  Updated: 2017-01-24  Resolved: 2017-01-24

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.2
Fix Version/s: 10.2.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: json-10.2

Issue Links:
Relates
relates to MDEV-9143 JSON_xxx functions Closed

 Description   

MySQL 5.7

MySQL [test]> SELECT JSON_MERGE('a','b');
ERROR 3141 (22032): Invalid JSON text in argument 1 to function json_merge: "Invalid value." at position 0.

MariaDB 10.2

MariaDB [test]> SELECT JSON_MERGE('a','b');
+---------------------+
| JSON_MERGE('a','b') |
+---------------------+
| ["a", "b"]          |
+---------------------+
1 row in set (0.00 sec)



 Comments   
Comment by Alexey Botchkov [ 2016-12-05 ]

http://lists.askmonty.org/pipermail/commits/2016-December/010214.html

Comment by Ian Gilfillan [ 2017-01-23 ]

In 10.2.3 this now returns NULL instead of the warning in MySQL 5.7.

MariaDB 10.2.3

SELECT JSON_MERGE('a','b');
+---------------------+
| JSON_MERGE('a','b') |
+---------------------+
| NULL                |
+---------------------+

MySQL 5.7

SELECT JSON_MERGE('a','b');
ERROR 3141 (22032): Invalid JSON text in argument 1 to function json_merge: "Invalid value." at position 0.


UPDATE: Apologies, different defaults and the warning does appear.

SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------------------+
| Level   | Code | Message                                                                        |
+---------+------+--------------------------------------------------------------------------------+
| Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_merge' at position 1 |
+---------+------+--------------------------------------------------------------------------------+

Safe to re-close, unfortunately I can't do this.

Generated at Thu Feb 08 07:50:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.