[MDEV-13104] Json functions Created: 2017-06-15  Updated: 2017-09-12  Resolved: 2017-09-12

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.2.6
Fix Version/s: 10.2.9

Type: Bug Priority: Major
Reporter: Aleksey M Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

SELECT JSON_MERGE('[{"a":"b"}]', '{"c":"d"}');
-- [{"a": "b"}, {"c": "d"}]
 
SELECT JSON_MERGE('[]', '{"c":"d"}');
-- MariaDb 10.2: NULL <-- bug
-- MySql 5.7: [{"c": "d"}]



 Comments   
Comment by Elena Stepanova [ 2017-06-15 ]

Thanks for the report.

JSON_MERGE complains about the empty array:

MariaDB [test]> SELECT JSON_MERGE('[]', '{"c":"d"}');
+-------------------------------+
| JSON_MERGE('[]', '{"c":"d"}') |
+-------------------------------+
| NULL                          |
+-------------------------------+
1 row in set, 1 warning (0.00 sec)
 
MariaDB [test]> SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------------------+
| Level   | Code | Message                                                                        |
+---------+------+--------------------------------------------------------------------------------+
| Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_merge' at position 2 |
+---------+------+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)

But JSON_VALID says it's okay:

MariaDB [test]> SELECT JSON_VALID('[]');
+------------------+
| JSON_VALID('[]') |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

Comment by Steven WdV [ 2017-09-11 ]

Relates to / duplicate of MDEV-13324.
EDIT: maybe actually the other way around.

Generated at Thu Feb 08 08:02:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.